Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

rust: driver-core: Update ARef and AlwaysRefCounted imports from sync::aref

Update call sites in the driver-core files and its related samples
to import `ARef` and `AlwaysRefCounted` from `sync::aref`
instead of `types`.

This aligns with the ongoing effort to move `ARef` and
`AlwaysRefCounted` to sync.

Suggested-by: Benno Lossin <lossin@kernel.org>
Link: https://github.com/Rust-for-Linux/linux/issues/1173
Signed-off-by: Shankari Anand <shankari.ak0208@gmail.com>
Link: https://lore.kernel.org/r/20250814104615.355106-1-shankari.ak0208@gmail.com
Signed-off-by: Danilo Krummrich <dakr@kernel.org>

authored by

Shankari Anand and committed by
Danilo Krummrich
1e180614 b6a37d1d

+13 -11
+1 -1
rust/kernel/auxiliary.rs
··· 245 245 kernel::impl_device_context_into_aref!(Device); 246 246 247 247 // SAFETY: Instances of `Device` are always reference-counted. 248 - unsafe impl crate::types::AlwaysRefCounted for Device { 248 + unsafe impl crate::sync::aref::AlwaysRefCounted for Device { 249 249 fn inc_ref(&self) { 250 250 // SAFETY: The existence of a shared reference guarantees that the refcount is non-zero. 251 251 unsafe { bindings::get_device(self.as_ref().as_raw()) };
+4 -3
rust/kernel/device.rs
··· 6 6 7 7 use crate::{ 8 8 bindings, 9 - types::{ARef, ForeignOwnable, Opaque}, 9 + sync::aref::ARef, 10 + types::{ForeignOwnable, Opaque}, 10 11 }; 11 12 use core::{fmt, marker::PhantomData, ptr}; 12 13 ··· 293 292 kernel::impl_device_context_into_aref!(Device); 294 293 295 294 // SAFETY: Instances of `Device` are always reference-counted. 296 - unsafe impl crate::types::AlwaysRefCounted for Device { 295 + unsafe impl crate::sync::aref::AlwaysRefCounted for Device { 297 296 fn inc_ref(&self) { 298 297 // SAFETY: The existence of a shared reference guarantees that the refcount is non-zero. 299 298 unsafe { bindings::get_device(self.as_raw()) }; ··· 412 411 #[macro_export] 413 412 macro_rules! __impl_device_context_into_aref { 414 413 ($src:ty, $device:tt) => { 415 - impl ::core::convert::From<&$device<$src>> for $crate::types::ARef<$device> { 414 + impl ::core::convert::From<&$device<$src>> for $crate::sync::aref::ARef<$device> { 416 415 fn from(dev: &$device<$src>) -> Self { 417 416 (&**dev).into() 418 417 }
+2 -2
rust/kernel/devres.rs
··· 13 13 ffi::c_void, 14 14 prelude::*, 15 15 revocable::{Revocable, RevocableGuard}, 16 - sync::{rcu, Completion}, 17 - types::{ARef, ForeignOwnable, Opaque, ScopeGuard}, 16 + sync::{aref::ARef, rcu, Completion}, 17 + types::{ForeignOwnable, Opaque, ScopeGuard}, 18 18 }; 19 19 20 20 use pin_init::Wrapper;
+3 -2
rust/kernel/pci.rs
··· 13 13 io::{Io, IoRaw}, 14 14 irq::{self, IrqRequest}, 15 15 str::CStr, 16 - types::{ARef, Opaque}, 16 + sync::aref::ARef, 17 + types::Opaque, 17 18 ThisModule, 18 19 }; 19 20 use core::{ ··· 545 544 impl crate::dma::Device for Device<device::Core> {} 546 545 547 546 // SAFETY: Instances of `Device` are always reference-counted. 548 - unsafe impl crate::types::AlwaysRefCounted for Device { 547 + unsafe impl crate::sync::aref::AlwaysRefCounted for Device { 549 548 fn inc_ref(&self) { 550 549 // SAFETY: The existence of a shared reference guarantees that the refcount is non-zero. 551 550 unsafe { bindings::pci_dev_get(self.as_raw()) };
+1 -1
rust/kernel/platform.rs
··· 468 468 impl crate::dma::Device for Device<device::Core> {} 469 469 470 470 // SAFETY: Instances of `Device` are always reference-counted. 471 - unsafe impl crate::types::AlwaysRefCounted for Device { 471 + unsafe impl crate::sync::aref::AlwaysRefCounted for Device { 472 472 fn inc_ref(&self) { 473 473 // SAFETY: The existence of a shared reference guarantees that the refcount is non-zero. 474 474 unsafe { bindings::get_device(self.as_ref().as_raw()) };
+1 -1
samples/rust/rust_driver_pci.rs
··· 4 4 //! 5 5 //! To make this driver probe, QEMU must be run with `-device pci-testdev`. 6 6 7 - use kernel::{bindings, c_str, device::Core, devres::Devres, pci, prelude::*, types::ARef}; 7 + use kernel::{bindings, c_str, device::Core, devres::Devres, pci, prelude::*, sync::aref::ARef}; 8 8 9 9 struct Regs; 10 10
+1 -1
samples/rust/rust_driver_platform.rs
··· 72 72 of, platform, 73 73 prelude::*, 74 74 str::CString, 75 - types::ARef, 75 + sync::aref::ARef, 76 76 }; 77 77 78 78 struct SampleDriver {