pub trait Driver: Send {
type IdInfo: 'static;
const OF_ID_TABLE: Option<IdTable<Self::IdInfo>> = None;
const ACPI_ID_TABLE: Option<IdTable<Self::IdInfo>> = None;
// Required method
fn probe(
dev: &Device<Core>,
id_info: Option<&Self::IdInfo>,
) -> Result<Pin<KBox<Self>>>;
}
Expand description
The platform driver trait.
Drivers must implement this trait in order to get a platform driver registered.
§Examples
struct MyDriver;
kernel::of_device_table!(
OF_TABLE,
MODULE_OF_TABLE,
<MyDriver as platform::Driver>::IdInfo,
[
(of::DeviceId::new(c_str!("test,device")), ())
]
);
kernel::acpi_device_table!(
ACPI_TABLE,
MODULE_ACPI_TABLE,
<MyDriver as platform::Driver>::IdInfo,
[
(acpi::DeviceId::new(c_str!("LNUXBEEF")), ())
]
);
impl platform::Driver for MyDriver {
type IdInfo = ();
const OF_ID_TABLE: Option<of::IdTable<Self::IdInfo>> = Some(&OF_TABLE);
const ACPI_ID_TABLE: Option<acpi::IdTable<Self::IdInfo>> = Some(&ACPI_TABLE);
fn probe(
_pdev: &platform::Device<Core>,
_id_info: Option<&Self::IdInfo>,
) -> Result<Pin<KBox<Self>>> {
Err(ENODEV)
}
}
Provided Associated Constants§
Sourceconst OF_ID_TABLE: Option<IdTable<Self::IdInfo>> = None
const OF_ID_TABLE: Option<IdTable<Self::IdInfo>> = None
The table of OF device ids supported by the driver.
Sourceconst ACPI_ID_TABLE: Option<IdTable<Self::IdInfo>> = None
const ACPI_ID_TABLE: Option<IdTable<Self::IdInfo>> = None
The table of ACPI device ids supported by the driver.
Required Associated Types§
Required Methods§
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.