Lines Matching defs:Device

63         let adev = unsafe { &*adev.cast::<Device<device::CoreInternal>>() };
83 let adev = unsafe { &*adev.cast::<Device<device::CoreInternal>>() };
86 // `probe_callback`, hence it's guaranteed that `Device::set_drvdata()` has been called
187 fn probe(dev: &Device<device::Core>, id_info: &Self::IdInfo) -> Result<Pin<KBox<Self>>>;
198 /// A [`Device`] instance represents a valid `struct auxiliary_device` created by the C portion of
201 pub struct Device<Ctx: device::DeviceContext = device::Normal>(
206 impl<Ctx: device::DeviceContext> Device<Ctx> {
218 /// Returns a reference to the parent [`device::Device`], if any.
219 pub fn parent(&self) -> Option<&device::Device> {
221 // CAST: `Device<Ctx: DeviceContext>` types are transparent to each other.
222 let ptr: *const Device = ptr.cast();
230 impl Device {
242 // SAFETY: `Device` is a transparent wrapper of a type that doesn't depend on `Device`'s generic
244 kernel::impl_device_context_deref!(unsafe { Device });
245 kernel::impl_device_context_into_aref!(Device);
247 // SAFETY: Instances of `Device` are always reference-counted.
248 unsafe impl crate::sync::aref::AlwaysRefCounted for Device {
267 impl<Ctx: device::DeviceContext> AsRef<device::Device<Ctx>> for Device<Ctx> {
268 fn as_ref(&self) -> &device::Device<Ctx> {
274 unsafe { device::Device::from_raw(dev) }
278 // SAFETY: A `Device` is always reference-counted and can be released from any thread.
279 unsafe impl Send for Device {}
281 // SAFETY: `Device` can be shared among threads because all methods of `Device`
282 // (i.e. `Device<Normal>) are thread safe.
283 unsafe impl Sync for Device {}
298 pub fn new(parent: &device::Device, name: &CStr, id: u32, modname: &CStr) -> Result<Self> {
305 (*adev).dev.release = Some(Device::release);
315 // by `Device::release` when the last reference to the `struct auxiliary_device` is dropped.