]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
rust: driver-core: Update ARef and AlwaysRefCounted imports from sync::aref
authorShankari Anand <shankari.ak0208@gmail.com>
Thu, 14 Aug 2025 10:46:15 +0000 (16:16 +0530)
committerDanilo Krummrich <dakr@kernel.org>
Fri, 15 Aug 2025 20:34:41 +0000 (22:34 +0200)
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>
rust/kernel/auxiliary.rs
rust/kernel/device.rs
rust/kernel/devres.rs
rust/kernel/pci.rs
rust/kernel/platform.rs
samples/rust/rust_driver_pci.rs
samples/rust/rust_driver_platform.rs

index f73c460665ec19c6921bc60252574ec9fc63fd1e..8dc7490a79a4a954771950c140ff89afccc45837 100644 (file)
@@ -245,7 +245,7 @@ kernel::impl_device_context_deref!(unsafe { Device });
 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()) };
index b8613289de8e7cea3ad7e32ec088eedc28ebf723..b860ab389f1812c6fc0290649c44e0d2c4ada035 100644 (file)
@@ -6,7 +6,8 @@
 
 use crate::{
     bindings,
-    types::{ARef, ForeignOwnable, Opaque},
+    sync::aref::ARef,
+    types::{ForeignOwnable, Opaque},
 };
 use core::{fmt, marker::PhantomData, ptr};
 
@@ -292,7 +293,7 @@ kernel::impl_device_context_deref!(unsafe { Device });
 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()) };
@@ -411,7 +412,7 @@ macro_rules! impl_device_context_deref {
 #[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()
             }
index da18091143a67fcfbb247e7cb4f59f5a4932cac5..99b7520019f05166a5c15162165db5d78e7eb3de 100644 (file)
@@ -13,8 +13,8 @@ use crate::{
     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;
index 08fb69e5eb97516d9f39469a9e166a29b01d27a1..cae4e274f7766f87bdda292d26c086ad42b042d0 100644 (file)
@@ -13,7 +13,8 @@ use crate::{
     io::{Io, IoRaw},
     irq::{self, IrqRequest},
     str::CStr,
-    types::{ARef, Opaque},
+    sync::aref::ARef,
+    types::Opaque,
     ThisModule,
 };
 use core::{
@@ -544,7 +545,7 @@ kernel::impl_device_context_into_aref!(Device);
 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()) };
index ce2bb4d4e882892c9085b0558d892315dac3ce4d..7205fe3416d36ce13f945c0950452d47fb65c1bb 100644 (file)
@@ -468,7 +468,7 @@ kernel::impl_device_context_into_aref!(Device);
 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()) };
index 606946ff4d7fd98e206ee6420a620d1c44eb0377..0798019014cd9551d62972c84c165484134f5aea 100644 (file)
@@ -4,7 +4,7 @@
 //!
 //! 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;
 
index 69ed55b7b0faad51629d2aa781bd712dd3aaf89e..6473baf4f1206a4c79edbdeb1182dabfa3223027 100644 (file)
@@ -72,7 +72,7 @@ use kernel::{
     of, platform,
     prelude::*,
     str::CString,
-    types::ARef,
+    sync::aref::ARef,
 };
 
 struct SampleDriver {