Lines Matching +full:platform +full:- +full:data

1 // SPDX-License-Identifier: GPL-2.0
3 //! Abstractions for the platform bus.
19 /// An adapter for the registration of platform drivers.
31 ) -> Result { in register()
56 extern "C" fn probe_callback(pdev: *mut bindings::platform_device) -> kernel::ffi::c_int { in probe_callback()
57 // SAFETY: The platform bus only ever calls the probe callback with a valid `pdev`. in probe_callback()
65 Ok(data) => { in probe_callback()
66 // Let the `struct platform_device` own a reference of the driver's private data. in probe_callback()
69 unsafe { bindings::platform_set_drvdata(pdev.as_raw(), data.into_foreign() as _) }; in probe_callback()
91 fn of_id_table() -> Option<of::IdTable<Self::IdInfo>> { in of_id_table()
96 /// Declares a kernel module that exposes a single platform driver.
112 $crate::module_driver!(<T>, $crate::platform::Adapter<T>, { $($f)* });
116 /// The platform driver trait.
118 /// Drivers must implement this trait in order to get a platform driver registered.
123 /// # use kernel::{bindings, c_str, of, platform};
130 /// <MyDriver as platform::Driver>::IdInfo,
136 /// impl platform::Driver for MyDriver {
141 /// _pdev: &mut platform::Device,
143 /// ) -> Result<Pin<KBox<Self>>> {
149 /// The type holding driver private data about each device id supported by the driver.
159 /// Platform driver probe.
161 /// Called when a new platform device is added or discovered.
163 fn probe(dev: &mut Device, id_info: Option<&Self::IdInfo>) -> Result<Pin<KBox<Self>>>; in probe()
166 /// The platform device representation.
168 /// A platform device is based on an always reference counted `device:Device` instance. Cloning a
169 /// platform device, hence, also increments the base device' reference count.
185 unsafe fn from_dev(dev: ARef<device::Device>) -> Self { in from_dev()
189 fn as_raw(&self) -> *mut bindings::platform_device { in as_raw()
197 fn as_ref(&self) -> &device::Device { in as_ref()