Skip to main content

RegistrationOps

Trait RegistrationOps 

Source
pub unsafe trait RegistrationOps: DriverLayout {
    // Required methods
    unsafe fn register(
        reg: &Opaque<Self::DriverType>,
        name: &'static CStr,
        module: &'static ThisModule,
    ) -> Result;
    unsafe fn unregister(reg: &Opaque<Self::DriverType>);
}
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 (DriverType).

For instance, the PCI subsystem would set DriverType 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 DriverType is only valid if a preceding call to RegistrationOps::register has been successful.

Required Methods§

Source

unsafe fn register( reg: &Opaque<Self::DriverType>, 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::DriverType>)

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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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