Lines Matching defs:Device

95             let dev: &device::Device<device::CoreInternal<'_>> = intf.as_ref();
108 let dev: &device::Device<device::CoreInternal<'_>> = intf.as_ref();
111 // `probe_callback`, hence it's guaranteed that `Device::set_drvdata()` has been called
372 impl<Ctx: device::DeviceContext> AsRef<device::Device<Ctx>> for Interface<Ctx> {
373 fn as_ref(&self) -> &device::Device<Ctx> {
379 unsafe { device::Device::from_raw(dev) }
383 impl<Ctx: device::DeviceContext> AsRef<Device> for Interface<Ctx> {
384 fn as_ref(&self) -> &Device {
424 /// A [`Device`] instance represents a valid [`struct usb_device`] created by the C portion of the
429 struct Device<Ctx: device::DeviceContext = device::Normal>(
434 impl<Ctx: device::DeviceContext> Device<Ctx> {
440 // SAFETY: `Device` is a transparent wrapper of a type that doesn't depend on `Device`'s generic
442 kernel::impl_device_context_deref!(unsafe { Device });
443 kernel::impl_device_context_into_aref!(Device);
445 // SAFETY: Instances of `Device` are always reference-counted.
446 unsafe impl AlwaysRefCounted for Device {
448 // SAFETY: The invariants of `Device` guarantee that `self.as_raw()`
460 impl<Ctx: device::DeviceContext> AsRef<device::Device<Ctx>> for Device<Ctx> {
461 fn as_ref(&self) -> &device::Device<Ctx> {
467 unsafe { device::Device::from_raw(dev) }
471 // SAFETY: A `Device` is always reference-counted and can be released from any thread.
472 unsafe impl Send for Device {}
474 // SAFETY: It is safe to send a &Device to another thread because we do not
476 unsafe impl Sync for Device {}
478 // SAFETY: Same as `Device<Normal>` -- the underlying `struct usb_device` is the same;
480 unsafe impl Sync for Device<device::Bound> {}