Trait kernel::platdev::PlatformDriver[][src]

pub trait PlatformDriver {
    type DrvData: PointerWrapper;
    fn probe(device_id: i32) -> Result<Self::DrvData>;
fn remove(device_id: i32, drv_data: Self::DrvData) -> Result; }
Expand description

Trait for implementers of platform drivers.

Implement this trait whenever you create a platform driver.

Associated Types

Device driver data.

Corresponds to the data set or retrieved via the kernel’s platform_{set,get}_drvdata() functions.

Require that DrvData implements PointerWrapper. We guarantee to never move the underlying wrapped data structure. This allows driver writers to use pinned or self-referential data structures.

Required methods

Platform driver probe.

Called when a new platform device is added or discovered. Implementers should attempt to initialize the device here.

Platform driver remove.

Called when a platform device is removed. Implementers should prepare the device for complete removal here.

Implementors