Lines Matching defs:Device
73 let pdev = unsafe { &*pdev.cast::<Device<device::CoreInternal>>() };
89 let pdev = unsafe { &*pdev.cast::<Device<device::CoreInternal>>() };
92 // `probe_callback`, hence it's guaranteed that `Device::set_drvdata()` has been called
167 /// _pdev: &platform::Device<Core>,
193 fn probe(dev: &Device<device::Core>, id_info: Option<&Self::IdInfo>)
198 /// Called when a [`Device`] is unbound from its bound [`Driver`]. Implementing this callback
202 /// `&Device<Core>` or `&Device<Bound>` reference. For instance, drivers may try to perform I/O
206 fn unbind(dev: &Device<device::Core>, this: Pin<&Self>) {
219 /// A [`Device`] instance represents a valid `struct platform_device` created by the C portion of
222 pub struct Device<Ctx: device::DeviceContext = device::Normal>(
227 impl<Ctx: device::DeviceContext> Device<Ctx> {
270 impl Device<Bound> {
342 impl Device<Bound> {
463 // SAFETY: `Device` is a transparent wrapper of a type that doesn't depend on `Device`'s generic
465 kernel::impl_device_context_deref!(unsafe { Device });
466 kernel::impl_device_context_into_aref!(Device);
468 impl crate::dma::Device for Device<device::Core> {}
470 // SAFETY: Instances of `Device` are always reference-counted.
471 unsafe impl crate::sync::aref::AlwaysRefCounted for Device {
483 impl<Ctx: device::DeviceContext> AsRef<device::Device<Ctx>> for Device<Ctx> {
484 fn as_ref(&self) -> &device::Device<Ctx> {
490 unsafe { device::Device::from_raw(dev) }
494 impl<Ctx: device::DeviceContext> TryFrom<&device::Device<Ctx>> for &Device<Ctx> {
497 fn try_from(dev: &device::Device<Ctx>) -> Result<Self, Self::Error> {
498 // SAFETY: By the type invariant of `Device`, `dev.as_raw()` is a valid pointer to a
514 // SAFETY: A `Device` is always reference-counted and can be released from any thread.
515 unsafe impl Send for Device {}
517 // SAFETY: `Device` can be shared among threads because all methods of `Device`
518 // (i.e. `Device<Normal>) are thread safe.
519 unsafe impl Sync for Device {}