kernel::impl_device_context_into_aref!(Device);
// SAFETY: Instances of `Device` are always reference-counted.
-unsafe impl crate::types::AlwaysRefCounted for Device {
+unsafe impl crate::sync::aref::AlwaysRefCounted for Device {
fn inc_ref(&self) {
// SAFETY: The existence of a shared reference guarantees that the refcount is non-zero.
unsafe { bindings::get_device(self.as_ref().as_raw()) };
use crate::{
bindings,
- types::{ARef, ForeignOwnable, Opaque},
+ sync::aref::ARef,
+ types::{ForeignOwnable, Opaque},
};
use core::{fmt, marker::PhantomData, ptr};
kernel::impl_device_context_into_aref!(Device);
// SAFETY: Instances of `Device` are always reference-counted.
-unsafe impl crate::types::AlwaysRefCounted for Device {
+unsafe impl crate::sync::aref::AlwaysRefCounted for Device {
fn inc_ref(&self) {
// SAFETY: The existence of a shared reference guarantees that the refcount is non-zero.
unsafe { bindings::get_device(self.as_raw()) };
#[macro_export]
macro_rules! __impl_device_context_into_aref {
($src:ty, $device:tt) => {
- impl ::core::convert::From<&$device<$src>> for $crate::types::ARef<$device> {
+ impl ::core::convert::From<&$device<$src>> for $crate::sync::aref::ARef<$device> {
fn from(dev: &$device<$src>) -> Self {
(&**dev).into()
}
ffi::c_void,
prelude::*,
revocable::{Revocable, RevocableGuard},
- sync::{rcu, Completion},
- types::{ARef, ForeignOwnable, Opaque, ScopeGuard},
+ sync::{aref::ARef, rcu, Completion},
+ types::{ForeignOwnable, Opaque, ScopeGuard},
};
use pin_init::Wrapper;
io::{Io, IoRaw},
irq::{self, IrqRequest},
str::CStr,
- types::{ARef, Opaque},
+ sync::aref::ARef,
+ types::Opaque,
ThisModule,
};
use core::{
impl crate::dma::Device for Device<device::Core> {}
// SAFETY: Instances of `Device` are always reference-counted.
-unsafe impl crate::types::AlwaysRefCounted for Device {
+unsafe impl crate::sync::aref::AlwaysRefCounted for Device {
fn inc_ref(&self) {
// SAFETY: The existence of a shared reference guarantees that the refcount is non-zero.
unsafe { bindings::pci_dev_get(self.as_raw()) };
impl crate::dma::Device for Device<device::Core> {}
// SAFETY: Instances of `Device` are always reference-counted.
-unsafe impl crate::types::AlwaysRefCounted for Device {
+unsafe impl crate::sync::aref::AlwaysRefCounted for Device {
fn inc_ref(&self) {
// SAFETY: The existence of a shared reference guarantees that the refcount is non-zero.
unsafe { bindings::get_device(self.as_ref().as_raw()) };
//!
//! To make this driver probe, QEMU must be run with `-device pci-testdev`.
-use kernel::{bindings, c_str, device::Core, devres::Devres, pci, prelude::*, types::ARef};
+use kernel::{bindings, c_str, device::Core, devres::Devres, pci, prelude::*, sync::aref::ARef};
struct Regs;
of, platform,
prelude::*,
str::CString,
- types::ARef,
+ sync::aref::ARef,
};
struct SampleDriver {