Shankari Anand
2025-Nov-23 09:25 UTC
[PATCH 00/10] rust: refactor ARef and AlwaysRefCounted imports
This series updates the import sites of `ARef` and
`AlwaysRefCounted` in the Rust kernel code to use `sync::aref` instead
of the previous `types` module.
The refactor to `sync::aref` from `types::` was introduced in the commit:
commit 07dad44aa9a9
("rust: kernel: move ARef and AlwaysRefCounted to sync::aref")
link [1]
The goal of this series is to complete the migration of these
types to `sync`, as discussed with Miguel Ojeda [2].
The last commit in this series removes the temporary re-exports
from `types.rs` that were originally added to avoid breaking the
build during the transition.
[1]:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=07dad44aa9a93b16af19e8609a10b241c352b440
[2]:
https://lore.kernel.org/lkml/CANiq72=hSTpAj7w8bvcwoJkivxD_FPKnx9jD6iNvhsENnnXBzg
at mail.gmail.com/
Shankari Anand (10):
drivers: android: binder: Update ARef imports from sync::aref
drivers: gpu: Update ARef imports from sync::aref
rust: device: Update ARef and AlwaysRefCounted imports from sync::aref
rust: drm: Update AlwaysRefCounted imports to use sync::aref
rust: kernel: Update ARef and AlwaysRefCounted imports to use
sync::aref
rust: kernel: Update ARef and AlwaysRefCounted imports to use
sync::aref
rust: kernel: Update ARef imports to use sync::aref
rust: kernel: Update AlwaysRefCounted imports to use sync::aref
samples: rust: Update ARef imports to use sync::aref
rust: kernel: remove temporary re-exports of ARef and AlwaysRefCounted
drivers/android/binder/process.rs | 2 +-
drivers/android/binder/thread.rs | 3 +--
drivers/gpu/drm/tyr/driver.rs | 2 +-
drivers/gpu/nova-core/gsp/sequencer.rs | 2 +-
drivers/gpu/nova-core/vbios.rs | 2 +-
rust/kernel/device.rs | 4 ++--
rust/kernel/device/property.rs | 5 +++--
rust/kernel/drm/gem/mod.rs | 2 +-
rust/kernel/i2c.rs | 10 ++++------
rust/kernel/pwm.rs | 3 ++-
rust/kernel/scatterlist.rs | 3 ++-
rust/kernel/types.rs | 2 --
rust/kernel/usb.rs | 3 ++-
samples/rust/rust_debugfs.rs | 2 +-
14 files changed, 22 insertions(+), 23 deletions(-)
base-commit: d724c6f85e80a23ed46b7ebc6e38b527c09d64f5
--
2.34.1
Shankari Anand
2025-Nov-23 09:25 UTC
[PATCH 01/10] drivers: android: binder: Update ARef imports from sync::aref
Update call sites in binder files to import `ARef`
from `sync::aref` instead of `types`.
This aligns with the ongoing effort to move `ARef` and
`AlwaysRefCounted` to sync.
Suggested-by: Benno Lossin <lossin at kernel.org>
Link: https://github.com/Rust-for-Linux/linux/issues/1173
Signed-off-by: Shankari Anand <shankari.ak0208 at gmail.com>
---
drivers/android/binder/process.rs | 2 +-
drivers/android/binder/thread.rs | 3 +--
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/android/binder/process.rs
b/drivers/android/binder/process.rs
index e5237e9ec552..1409129ff82a 100644
--- a/drivers/android/binder/process.rs
+++ b/drivers/android/binder/process.rs
@@ -27,11 +27,11 @@
seq_print,
sync::poll::PollTable,
sync::{
+ aref::ARef,
lock::{spinlock::SpinLockBackend, Guard},
Arc, ArcBorrow, CondVar, CondVarTimeoutResult, Mutex, SpinLock,
UniqueArc,
},
task::Task,
- types::ARef,
uaccess::{UserSlice, UserSliceReader},
uapi,
workqueue::{self, Work},
diff --git a/drivers/android/binder/thread.rs b/drivers/android/binder/thread.rs
index 7e34ccd394f8..033af3ce352e 100644
--- a/drivers/android/binder/thread.rs
+++ b/drivers/android/binder/thread.rs
@@ -16,9 +16,8 @@
seq_file::SeqFile,
seq_print,
sync::poll::{PollCondVar, PollTable},
- sync::{Arc, SpinLock},
+ sync::{aref::ARef, Arc, SpinLock},
task::Task,
- types::ARef,
uaccess::UserSlice,
uapi,
};
--
2.34.1
Shankari Anand
2025-Nov-23 09:26 UTC
[PATCH 02/10] drivers: gpu: Update ARef imports from sync::aref
Update call sites to import `ARef` from `sync::aref`
instead of `types`.
This aligns with the ongoing effort to move `ARef` and
`AlwaysRefCounted` to sync.
Suggested-by: Benno Lossin <lossin at kernel.org>
Link: https://github.com/Rust-for-Linux/linux/issues/1173
Signed-off-by: Shankari Anand <shankari.ak0208 at gmail.com>
---
drivers/gpu/drm/tyr/driver.rs | 2 +-
drivers/gpu/nova-core/gsp/sequencer.rs | 2 +-
drivers/gpu/nova-core/vbios.rs | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/tyr/driver.rs b/drivers/gpu/drm/tyr/driver.rs
index 0389c558c036..264c2362237a 100644
--- a/drivers/gpu/drm/tyr/driver.rs
+++ b/drivers/gpu/drm/tyr/driver.rs
@@ -16,10 +16,10 @@
use kernel::regulator;
use kernel::regulator::Regulator;
use kernel::sizes::SZ_2M;
+use kernel::sync::aref::ARef;
use kernel::sync::Arc;
use kernel::sync::Mutex;
use kernel::time;
-use kernel::types::ARef;
use crate::file::File;
use crate::gem::TyrObject;
diff --git a/drivers/gpu/nova-core/gsp/sequencer.rs
b/drivers/gpu/nova-core/gsp/sequencer.rs
index 2d0369c49092..9c689f0b21ab 100644
--- a/drivers/gpu/nova-core/gsp/sequencer.rs
+++ b/drivers/gpu/nova-core/gsp/sequencer.rs
@@ -14,12 +14,12 @@
device,
io::poll::read_poll_timeout,
prelude::*,
+ sync::aref::ARef, //
time::{
delay::fsleep,
Delta, //
},
transmute::FromBytes,
- types::ARef, //
};
use crate::{
diff --git a/drivers/gpu/nova-core/vbios.rs b/drivers/gpu/nova-core/vbios.rs
index abf423560ff4..7c26e4a2d61c 100644
--- a/drivers/gpu/nova-core/vbios.rs
+++ b/drivers/gpu/nova-core/vbios.rs
@@ -11,8 +11,8 @@
Alignable,
Alignment, //
},
+ sync::aref::ARef,
transmute::FromBytes,
- types::ARef,
};
use crate::{
--
2.34.1
Shankari Anand
2025-Nov-23 09:26 UTC
[PATCH 03/10] rust: device: Update ARef and AlwaysRefCounted imports from sync::aref
Update call sites 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 at kernel.org>
Link: https://github.com/Rust-for-Linux/linux/issues/1173
Signed-off-by: Shankari Anand <shankari.ak0208 at gmail.com>
---
rust/kernel/device.rs | 4 ++--
rust/kernel/device/property.rs | 5 +++--
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/rust/kernel/device.rs b/rust/kernel/device.rs
index c79be2e2bfe3..21bde8d95185 100644
--- a/rust/kernel/device.rs
+++ b/rust/kernel/device.rs
@@ -158,7 +158,7 @@
/// `bindings::device::release` is valid to be called from any thread, hence
`ARef<Device>` can be
/// dropped from any thread.
///
-/// [`AlwaysRefCounted`]: kernel::types::AlwaysRefCounted
+/// [`AlwaysRefCounted`]: kernel::sync::aref::AlwaysRefCounted
/// [`impl_device_context_deref`]: kernel::impl_device_context_deref
/// [`pci::Device`]: kernel::pci::Device
/// [`platform::Device`]: kernel::platform::Device
@@ -540,7 +540,7 @@ pub trait DeviceContext: private::Sealed {}
/// [`Device<Normal>`]. It is the only [`DeviceContext`] for which it is
valid to implement
/// [`AlwaysRefCounted`] for.
///
-/// [`AlwaysRefCounted`]: kernel::types::AlwaysRefCounted
+/// [`AlwaysRefCounted`]: kernel::sync::aref::AlwaysRefCounted
pub struct Normal;
/// The [`Core`] context is the context of a bus specific device when it
appears as argument of
diff --git a/rust/kernel/device/property.rs b/rust/kernel/device/property.rs
index 3a332a8c53a9..413221817ef1 100644
--- a/rust/kernel/device/property.rs
+++ b/rust/kernel/device/property.rs
@@ -14,7 +14,8 @@
fmt,
prelude::*,
str::{CStr, CString},
- types::{ARef, Opaque},
+ sync::aref::ARef,
+ types::Opaque,
};
/// A reference-counted fwnode_handle.
@@ -359,7 +360,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>)
-> fmt::Result {
}
// SAFETY: Instances of `FwNode` are always reference-counted.
-unsafe impl crate::types::AlwaysRefCounted for FwNode {
+unsafe impl crate::sync::aref::AlwaysRefCounted for FwNode {
fn inc_ref(&self) {
// SAFETY: The existence of a shared reference guarantees that the
// refcount is non-zero.
--
2.34.1
Shankari Anand
2025-Nov-23 09:26 UTC
[PATCH 04/10] rust: drm: Update AlwaysRefCounted imports to use sync::aref
Update call sites to import `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 at kernel.org>
Link: https://github.com/Rust-for-Linux/linux/issues/1173
Signed-off-by: Shankari Anand <shankari.ak0208 at gmail.com>
---
rust/kernel/drm/gem/mod.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/rust/kernel/drm/gem/mod.rs b/rust/kernel/drm/gem/mod.rs
index a7f682e95c01..76e6c40d525e 100644
--- a/rust/kernel/drm/gem/mod.rs
+++ b/rust/kernel/drm/gem/mod.rs
@@ -253,7 +253,7 @@ extern "C" fn free_callback(obj: *mut
bindings::drm_gem_object) {
}
// SAFETY: Instances of `Object<T>` are always reference-counted.
-unsafe impl<T: DriverObject> crate::types::AlwaysRefCounted for
Object<T> {
+unsafe impl<T: DriverObject> crate::sync::aref::AlwaysRefCounted for
Object<T> {
fn inc_ref(&self) {
// SAFETY: The existence of a shared reference guarantees that the
refcount is non-zero.
unsafe { bindings::drm_gem_object_get(self.as_raw()) };
--
2.34.1
Shankari Anand
2025-Nov-23 09:26 UTC
[PATCH 05/10] rust: kernel: Update ARef and AlwaysRefCounted imports to use sync::aref
Update call sites in `i2c.rs` 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 at kernel.org>
Link: https://github.com/Rust-for-Linux/linux/issues/1173
Signed-off-by: Shankari Anand <shankari.ak0208 at gmail.com>
---
rust/kernel/i2c.rs | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/rust/kernel/i2c.rs b/rust/kernel/i2c.rs
index 1aee46f59460..c50ca464d87c 100644
--- a/rust/kernel/i2c.rs
+++ b/rust/kernel/i2c.rs
@@ -17,10 +17,8 @@
of,
prelude::*,
str::CStrExt as _,
- types::{
- AlwaysRefCounted,
- Opaque, //
- }, //
+ sync::aref::AlwaysRefCounted,
+ types::Opaque, //
};
use core::{
@@ -32,7 +30,7 @@
}, //
};
-use kernel::types::ARef;
+use kernel::sync::aref::ARef;
/// An I2C device id table.
#[repr(transparent)]
@@ -408,7 +406,7 @@ pub fn get(index: i32) -> Result<ARef<Self>>
{
kernel::impl_device_context_into_aref!(I2cAdapter);
// SAFETY: Instances of `I2cAdapter` are always reference-counted.
-unsafe impl crate::types::AlwaysRefCounted for I2cAdapter {
+unsafe impl crate::sync::aref::AlwaysRefCounted for I2cAdapter {
fn inc_ref(&self) {
// SAFETY: The existence of a shared reference guarantees that the
refcount is non-zero.
unsafe { bindings::i2c_get_adapter(self.index()) };
--
2.34.1
Shankari Anand
2025-Nov-23 09:26 UTC
[PATCH 06/10] rust: kernel: Update ARef and AlwaysRefCounted imports to use sync::aref
Update call sites in `pwm.rs` 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 at kernel.org>
Link: https://github.com/Rust-for-Linux/linux/issues/1173
Signed-off-by: Shankari Anand <shankari.ak0208 at gmail.com>
---
rust/kernel/pwm.rs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/rust/kernel/pwm.rs b/rust/kernel/pwm.rs
index cb00f8a8765c..1605d13d5d64 100644
--- a/rust/kernel/pwm.rs
+++ b/rust/kernel/pwm.rs
@@ -13,7 +13,8 @@
devres,
error::{self, to_result},
prelude::*,
- types::{ARef, AlwaysRefCounted, Opaque}, //
+ sync::aref::{ARef, AlwaysRefCounted},
+ types::Opaque, //
};
use core::{marker::PhantomData, ptr::NonNull};
--
2.34.1
Shankari Anand
2025-Nov-23 09:27 UTC
[PATCH 07/10] rust: kernel: Update ARef imports to use sync::aref
Update call sites in `scatterlist.rs` to import `ARef`
from `sync::aref` instead of `types`.
This aligns with the ongoing effort to move `ARef` and
`AlwaysRefCounted` to sync.
Suggested-by: Benno Lossin <lossin at kernel.org>
Link: https://github.com/Rust-for-Linux/linux/issues/1173
Signed-off-by: Shankari Anand <shankari.ak0208 at gmail.com>
---
rust/kernel/scatterlist.rs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/rust/kernel/scatterlist.rs b/rust/kernel/scatterlist.rs
index 196fdb9a75e7..b83c468b5c63 100644
--- a/rust/kernel/scatterlist.rs
+++ b/rust/kernel/scatterlist.rs
@@ -38,7 +38,8 @@
io::ResourceSize,
page,
prelude::*,
- types::{ARef, Opaque},
+ sync::aref::ARef,
+ types::Opaque,
};
use core::{ops::Deref, ptr::NonNull};
--
2.34.1
Shankari Anand
2025-Nov-23 09:27 UTC
[PATCH 08/10] rust: kernel: Update AlwaysRefCounted imports to use sync::aref
Update call sites in `usb.rs` to import `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 at kernel.org>
Link: https://github.com/Rust-for-Linux/linux/issues/1173
Signed-off-by: Shankari Anand <shankari.ak0208 at gmail.com>
---
rust/kernel/usb.rs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/rust/kernel/usb.rs b/rust/kernel/usb.rs
index d10b65e9fb6a..79ff2f881572 100644
--- a/rust/kernel/usb.rs
+++ b/rust/kernel/usb.rs
@@ -12,7 +12,8 @@
error::{from_result, to_result, Result},
prelude::*,
str::CStr,
- types::{AlwaysRefCounted, Opaque},
+ sync::aref::AlwaysRefCounted,
+ types::Opaque,
ThisModule,
};
use core::{
--
2.34.1
Shankari Anand
2025-Nov-23 09:27 UTC
[PATCH 09/10] samples: rust: Update ARef imports to use sync::aref
Update call sites in `rust_debugfs.rs` to import `ARef`
from `sync::aref` instead of `types`.
This aligns with the ongoing effort to move `ARef` and
`AlwaysRefCounted` to sync.
Suggested-by: Benno Lossin <lossin at kernel.org>
Link: https://github.com/Rust-for-Linux/linux/issues/1173
Signed-off-by: Shankari Anand <shankari.ak0208 at gmail.com>
---
samples/rust/rust_debugfs.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/samples/rust/rust_debugfs.rs b/samples/rust/rust_debugfs.rs
index 025e8f9d12de..be245da577a1 100644
--- a/samples/rust/rust_debugfs.rs
+++ b/samples/rust/rust_debugfs.rs
@@ -39,7 +39,7 @@
use kernel::sizes::*;
use kernel::sync::atomic::{Atomic, Relaxed};
use kernel::sync::Mutex;
-use kernel::{acpi, device::Core, of, platform, str::CString, types::ARef};
+use kernel::{acpi, device::Core, of, platform, str::CString, sync::aref::ARef};
kernel::module_platform_driver! {
type: RustDebugFs,
--
2.34.1
Shankari Anand
2025-Nov-23 09:27 UTC
[PATCH 10/10] rust: kernel: remove temporary re-exports of ARef and AlwaysRefCounted
Remove the temporary re-exports of `ARef` and `AlwaysRefCounted`
from `types.rs` now that all in-tree users have been updated to
import them directly from `sync::aref`.
These re-exports were originally added to avoid breaking the
kernel build during the transition period while call sites were
incrementally migrated. With all users updated, they are no
longer needed.
Suggested-by: Benno Lossin <lossin at kernel.org>
Link: https://github.com/Rust-for-Linux/linux/issues/1173
Signed-off-by: Shankari Anand <shankari.ak0208 at gmail.com>
---
rust/kernel/types.rs | 2 --
1 file changed, 2 deletions(-)
diff --git a/rust/kernel/types.rs b/rust/kernel/types.rs
index 9c5e7dbf1632..4329d3c2c2e5 100644
--- a/rust/kernel/types.rs
+++ b/rust/kernel/types.rs
@@ -11,8 +11,6 @@
};
use pin_init::{PinInit, Wrapper, Zeroable};
-pub use crate::sync::aref::{ARef, AlwaysRefCounted};
-
/// Used to transfer ownership to and from foreign (non-Rust) languages.
///
/// Ownership is transferred from Rust to a foreign language by calling
[`Self::into_foreign`] and
--
2.34.1
Igor Korotin
2025-Nov-23 13:16 UTC
[PATCH 05/10] rust: kernel: Update ARef and AlwaysRefCounted imports to use sync::aref
Hello Shankari On 11/23/2025 9:24 AM, Shankari Anand wrote:> Update call sites in `i2c.rs` 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 at kernel.org> > Link: https://github.com/Rust-for-Linux/linux/issues/1173 > Signed-off-by: Shankari Anand <shankari.ak0208 at gmail.com> > --- > rust/kernel/i2c.rs | 10 ++++------ > 1 file changed, 4 insertions(+), 6 deletions(-) > > diff --git a/rust/kernel/i2c.rs b/rust/kernel/i2c.rs > index 1aee46f59460..c50ca464d87c 100644 > --- a/rust/kernel/i2c.rs > +++ b/rust/kernel/i2c.rs > @@ -17,10 +17,8 @@ > of, > prelude::*, > str::CStrExt as _, > - types::{ > - AlwaysRefCounted, > - Opaque, // > - }, // > + sync::aref::AlwaysRefCounted, > + types::Opaque, // > }; > > use core::{ > @@ -32,7 +30,7 @@ > }, // > }; > > -use kernel::types::ARef; > +use kernel::sync::aref::ARef; > > /// An I2C device id table. > #[repr(transparent)] > @@ -408,7 +406,7 @@ pub fn get(index: i32) -> Result<ARef<Self>> { > kernel::impl_device_context_into_aref!(I2cAdapter); > > // SAFETY: Instances of `I2cAdapter` are always reference-counted. > -unsafe impl crate::types::AlwaysRefCounted for I2cAdapter { > +unsafe impl crate::sync::aref::AlwaysRefCounted for I2cAdapter {NIT: This module already imports `AlwaysRefCounted`, so please use the imported name instead of the full path for consistency.> fn inc_ref(&self) { > // SAFETY: The existence of a shared reference guarantees that the refcount is non-zero. > unsafe { bindings::i2c_get_adapter(self.index()) };Thanks Igor
Alexandre Courbot
2025-Nov-24 12:16 UTC
[PATCH 02/10] drivers: gpu: Update ARef imports from sync::aref
On Sun Nov 23, 2025 at 6:24 PM JST, Shankari Anand wrote:> Update call sites to import `ARef` from `sync::aref` > instead of `types`. > > This aligns with the ongoing effort to move `ARef` and > `AlwaysRefCounted` to sync. > > Suggested-by: Benno Lossin <lossin at kernel.org> > Link: https://github.com/Rust-for-Linux/linux/issues/1173 > Signed-off-by: Shankari Anand <shankari.ak0208 at gmail.com> > --- > drivers/gpu/drm/tyr/driver.rs | 2 +- > drivers/gpu/nova-core/gsp/sequencer.rs | 2 +- > drivers/gpu/nova-core/vbios.rs | 2 +- > 3 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/tyr/driver.rs b/drivers/gpu/drm/tyr/driver.rs > index 0389c558c036..264c2362237a 100644 > --- a/drivers/gpu/drm/tyr/driver.rs > +++ b/drivers/gpu/drm/tyr/driver.rs > @@ -16,10 +16,10 @@ > use kernel::regulator; > use kernel::regulator::Regulator; > use kernel::sizes::SZ_2M; > +use kernel::sync::aref::ARef; > use kernel::sync::Arc; > use kernel::sync::Mutex; > use kernel::time; > -use kernel::types::ARef; > > use crate::file::File; > use crate::gem::TyrObject; > diff --git a/drivers/gpu/nova-core/gsp/sequencer.rs b/drivers/gpu/nova-core/gsp/sequencer.rs > index 2d0369c49092..9c689f0b21ab 100644 > --- a/drivers/gpu/nova-core/gsp/sequencer.rs > +++ b/drivers/gpu/nova-core/gsp/sequencer.rs > @@ -14,12 +14,12 @@ > device, > io::poll::read_poll_timeout, > prelude::*, > + sync::aref::ARef, // > time::{ > delay::fsleep, > Delta, // > }, > transmute::FromBytes, > - types::ARef, //I think you will want to move the trailing `//` to the new last line instead of carrying it when moving `ARef`. With this, for nova-core, Acked-by: Alexandre Courbot <acourbot at nvidia.com>
Joel Fernandes
2025-Nov-24 21:20 UTC
[PATCH 02/10] drivers: gpu: Update ARef imports from sync::aref
On 11/23/2025 4:24 AM, Shankari Anand wrote:> Update call sites to import `ARef` from `sync::aref` > instead of `types`. > > This aligns with the ongoing effort to move `ARef` and > `AlwaysRefCounted` to sync. > > Suggested-by: Benno Lossin <lossin at kernel.org> > Link: https://github.com/Rust-for-Linux/linux/issues/1173 > Signed-off-by: Shankari Anand <shankari.ak0208 at gmail.com>Reviewed-by: Joel Fernandes <joelagnelf at nvidia.com> thanks, - Joel> --- > drivers/gpu/drm/tyr/driver.rs | 2 +- > drivers/gpu/nova-core/gsp/sequencer.rs | 2 +- > drivers/gpu/nova-core/vbios.rs | 2 +- > 3 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/tyr/driver.rs b/drivers/gpu/drm/tyr/driver.rs > index 0389c558c036..264c2362237a 100644 > --- a/drivers/gpu/drm/tyr/driver.rs > +++ b/drivers/gpu/drm/tyr/driver.rs > @@ -16,10 +16,10 @@ > use kernel::regulator; > use kernel::regulator::Regulator; > use kernel::sizes::SZ_2M; > +use kernel::sync::aref::ARef; > use kernel::sync::Arc; > use kernel::sync::Mutex; > use kernel::time; > -use kernel::types::ARef; > > use crate::file::File; > use crate::gem::TyrObject; > diff --git a/drivers/gpu/nova-core/gsp/sequencer.rs b/drivers/gpu/nova-core/gsp/sequencer.rs > index 2d0369c49092..9c689f0b21ab 100644 > --- a/drivers/gpu/nova-core/gsp/sequencer.rs > +++ b/drivers/gpu/nova-core/gsp/sequencer.rs > @@ -14,12 +14,12 @@ > device, > io::poll::read_poll_timeout, > prelude::*, > + sync::aref::ARef, // > time::{ > delay::fsleep, > Delta, // > }, > transmute::FromBytes, > - types::ARef, // > }; > > use crate::{ > diff --git a/drivers/gpu/nova-core/vbios.rs b/drivers/gpu/nova-core/vbios.rs > index abf423560ff4..7c26e4a2d61c 100644 > --- a/drivers/gpu/nova-core/vbios.rs > +++ b/drivers/gpu/nova-core/vbios.rs > @@ -11,8 +11,8 @@ > Alignable, > Alignment, // > }, > + sync::aref::ARef, > transmute::FromBytes, > - types::ARef, > }; > > use crate::{
Alice Ryhl
2025-Nov-25 12:24 UTC
[PATCH 01/10] drivers: android: binder: Update ARef imports from sync::aref
On Sun, Nov 23, 2025 at 02:54:29PM +0530, Shankari Anand wrote:> Update call sites in binder files to import `ARef` > from `sync::aref` instead of `types`. > > This aligns with the ongoing effort to move `ARef` and > `AlwaysRefCounted` to sync. > > Suggested-by: Benno Lossin <lossin at kernel.org> > Link: https://github.com/Rust-for-Linux/linux/issues/1173 > Signed-off-by: Shankari Anand <shankari.ak0208 at gmail.com>Greg, please go ahead and pick up this one, thanks! Acked-by: Alice Ryhl <aliceryhl at google.com>
Alice Ryhl
2025-Nov-25 12:39 UTC
[PATCH 00/10] rust: refactor ARef and AlwaysRefCounted imports
On Sun, Nov 23, 2025 at 02:54:28PM +0530, Shankari Anand wrote:> This series updates the import sites of `ARef` and > `AlwaysRefCounted` in the Rust kernel code to use `sync::aref` instead > of the previous `types` module. > > The refactor to `sync::aref` from `types::` was introduced in the commit: > commit 07dad44aa9a9 > ("rust: kernel: move ARef and AlwaysRefCounted to sync::aref") > link [1] > > The goal of this series is to complete the migration of these > types to `sync`, as discussed with Miguel Ojeda [2]. > The last commit in this series removes the temporary re-exports > from `types.rs` that were originally added to avoid breaking the > build during the transition. > > [1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=07dad44aa9a93b16af19e8609a10b241c352b440 > [2]: https://lore.kernel.org/lkml/CANiq72=hSTpAj7w8bvcwoJkivxD_FPKnx9jD6iNvhsENnnXBzg at mail.gmail.com/ > > Shankari Anand (10): > drivers: android: binder: Update ARef imports from sync::aref > drivers: gpu: Update ARef imports from sync::aref > rust: device: Update ARef and AlwaysRefCounted imports from sync::aref > rust: drm: Update AlwaysRefCounted imports to use sync::aref > rust: kernel: Update ARef and AlwaysRefCounted imports to use > sync::aref > rust: kernel: Update ARef and AlwaysRefCounted imports to use > sync::aref > rust: kernel: Update ARef imports to use sync::aref > rust: kernel: Update AlwaysRefCounted imports to use sync::aref > samples: rust: Update ARef imports to use sync::aref > rust: kernel: remove temporary re-exports of ARef and AlwaysRefCounted > > drivers/android/binder/process.rs | 2 +- > drivers/android/binder/thread.rs | 3 +-- > drivers/gpu/drm/tyr/driver.rs | 2 +- > drivers/gpu/nova-core/gsp/sequencer.rs | 2 +- > drivers/gpu/nova-core/vbios.rs | 2 +- > rust/kernel/device.rs | 4 ++-- > rust/kernel/device/property.rs | 5 +++-- > rust/kernel/drm/gem/mod.rs | 2 +- > rust/kernel/i2c.rs | 10 ++++------ > rust/kernel/pwm.rs | 3 ++- > rust/kernel/scatterlist.rs | 3 ++- > rust/kernel/types.rs | 2 -- > rust/kernel/usb.rs | 3 ++- > samples/rust/rust_debugfs.rs | 2 +- > 14 files changed, 22 insertions(+), 23 deletions(-)I will pick up the DRM ones (patch 2 & 4) once the branch re-opens on Dec 15th. Alice
Igor Korotin
2025-Nov-29 12:21 UTC
[PATCH 05/10] rust: kernel: Update ARef and AlwaysRefCounted imports to use sync::aref
On 11/23/2025 9:24 AM, Shankari Anand wrote:> Update call sites in `i2c.rs` 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 at kernel.org> > Link: https://github.com/Rust-for-Linux/linux/issues/1173 > Signed-off-by: Shankari Anand <shankari.ak0208 at gmail.com> > --- > rust/kernel/i2c.rs | 10 ++++------ > 1 file changed, 4 insertions(+), 6 deletions(-) > > diff --git a/rust/kernel/i2c.rs b/rust/kernel/i2c.rs > index 1aee46f59460..c50ca464d87c 100644 > --- a/rust/kernel/i2c.rs > +++ b/rust/kernel/i2c.rs > @@ -17,10 +17,8 @@ > of, > prelude::*, > str::CStrExt as _, > - types::{ > - AlwaysRefCounted, > - Opaque, // > - }, // > + sync::aref::AlwaysRefCounted, > + types::Opaque, // > }; > > use core::{ > @@ -32,7 +30,7 @@ > }, // > }; > > -use kernel::types::ARef; > +use kernel::sync::aref::ARef; > > /// An I2C device id table. > #[repr(transparent)] > @@ -408,7 +406,7 @@ pub fn get(index: i32) -> Result<ARef<Self>> { > kernel::impl_device_context_into_aref!(I2cAdapter); > > // SAFETY: Instances of `I2cAdapter` are always reference-counted. > -unsafe impl crate::types::AlwaysRefCounted for I2cAdapter { > +unsafe impl crate::sync::aref::AlwaysRefCounted for I2cAdapter { > fn inc_ref(&self) { > // SAFETY: The existence of a shared reference guarantees that the refcount is non-zero. > unsafe { bindings::i2c_get_adapter(self.index()) };I'm fine with this going through either tree. Acked-by: Igor Korotin <igor.korotin.linux at gmail.com> Thanks