Trait RegistrationOps

Source
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.

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::pci::Adapter<T>

Source§

type RegType = pci_driver

Source§

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

Source§

type RegType = platform_driver