pub unsafe trait RegistrationOps {
    type RegType: Default;

    // Required methods
    unsafe fn register(
        reg: &Opaque<Self::RegType>,
        name: &'static CStr,
        module: &'static ThisModule
    ) -> Result;
    unsafe fn unregister(reg: &Opaque<Self::RegType>);
}
Expand description

The RegistrationOps trait serves as generic interface for subsystems (e.g., PCI, Platform, Amba, etc.) to provide the corresponding subsystem specific implementation to register / unregister a driver of the particular type (RegType).

For instance, the PCI subsystem would set RegType to bindings::pci_driver and call bindings::__pci_register_driver from RegistrationOps::register and bindings::pci_unregister_driver from RegistrationOps::unregister.

§Safety

A call to RegistrationOps::unregister for a given instance of RegType is only valid if a preceding call to RegistrationOps::register has been successful.

Required Associated Types§

source

type RegType: Default

The type that holds information about the registration. This is typically a struct defined by the C portion of the kernel.

Required Methods§

source

unsafe fn register( reg: &Opaque<Self::RegType>, name: &'static CStr, module: &'static ThisModule ) -> Result

Registers a driver.

§Safety

On success, reg must remain pinned and valid until the matching call to RegistrationOps::unregister.

source

unsafe fn unregister(reg: &Opaque<Self::RegType>)

Unregisters a driver previously registered with RegistrationOps::register.

§Safety

Must only be called after a preceding successful call to RegistrationOps::register for the same reg.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<T: Driver + 'static> RegistrationOps for kernel::pci::Adapter<T>

§

type RegType = pci_driver

source§

impl<T: Driver + 'static> RegistrationOps for kernel::platform::Adapter<T>

§

type RegType = platform_driver