rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/10] rust: refactor ARef and AlwaysRefCounted imports
@ 2025-11-23  9:24 Shankari Anand
  2025-11-23  9:24 ` [PATCH 01/10] drivers: android: binder: Update ARef imports from sync::aref Shankari Anand
                   ` (10 more replies)
  0 siblings, 11 replies; 22+ messages in thread
From: Shankari Anand @ 2025-11-23  9:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Arve Hjønnevåg, Todd Kjos,
	Martijn Coenen, Joel Fernandes, Christian Brauner, Carlos Llamas,
	Suren Baghdasaryan, Danilo Krummrich, Alice Ryhl,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, Alexandre Courbot, Rafael J . Wysocki,
	Miguel Ojeda, Alex Gaynor, Igor Korotin, Michal Wilczynski
  Cc: Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
	Andreas Hindborg, Trevor Gross, Daniel Almeida, Abdiel Janulgue,
	Robin Murphy, linux-kernel, dri-devel, nouveau, rust-for-linux,
	linux-pwm, Shankari Anand

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@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


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 01/10] drivers: android: binder: Update ARef imports from sync::aref
  2025-11-23  9:24 [PATCH 00/10] rust: refactor ARef and AlwaysRefCounted imports Shankari Anand
@ 2025-11-23  9:24 ` Shankari Anand
  2025-11-25 12:24   ` Alice Ryhl
  2025-11-23  9:24 ` [PATCH 02/10] drivers: gpu: " Shankari Anand
                   ` (9 subsequent siblings)
  10 siblings, 1 reply; 22+ messages in thread
From: Shankari Anand @ 2025-11-23  9:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Arve Hjønnevåg, Todd Kjos,
	Martijn Coenen, Joel Fernandes, Christian Brauner, Carlos Llamas,
	Suren Baghdasaryan, Danilo Krummrich, Alice Ryhl,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, Alexandre Courbot, Rafael J . Wysocki,
	Miguel Ojeda, Alex Gaynor, Igor Korotin, Michal Wilczynski
  Cc: Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
	Andreas Hindborg, Trevor Gross, Daniel Almeida, Abdiel Janulgue,
	Robin Murphy, linux-kernel, dri-devel, nouveau, rust-for-linux,
	linux-pwm, Shankari Anand

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@kernel.org>
Link: https://github.com/Rust-for-Linux/linux/issues/1173
Signed-off-by: Shankari Anand <shankari.ak0208@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


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 02/10] drivers: gpu: Update ARef imports from sync::aref
  2025-11-23  9:24 [PATCH 00/10] rust: refactor ARef and AlwaysRefCounted imports Shankari Anand
  2025-11-23  9:24 ` [PATCH 01/10] drivers: android: binder: Update ARef imports from sync::aref Shankari Anand
@ 2025-11-23  9:24 ` Shankari Anand
  2025-11-24 12:16   ` Alexandre Courbot
  2025-11-24 21:20   ` Joel Fernandes
  2025-11-23  9:24 ` [PATCH 03/10] rust: device: Update ARef and AlwaysRefCounted " Shankari Anand
                   ` (8 subsequent siblings)
  10 siblings, 2 replies; 22+ messages in thread
From: Shankari Anand @ 2025-11-23  9:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Arve Hjønnevåg, Todd Kjos,
	Martijn Coenen, Joel Fernandes, Christian Brauner, Carlos Llamas,
	Suren Baghdasaryan, Danilo Krummrich, Alice Ryhl,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, Alexandre Courbot, Rafael J . Wysocki,
	Miguel Ojeda, Alex Gaynor, Igor Korotin, Michal Wilczynski
  Cc: Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
	Andreas Hindborg, Trevor Gross, Daniel Almeida, Abdiel Janulgue,
	Robin Murphy, linux-kernel, dri-devel, nouveau, rust-for-linux,
	linux-pwm, Shankari Anand

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@kernel.org>
Link: https://github.com/Rust-for-Linux/linux/issues/1173
Signed-off-by: Shankari Anand <shankari.ak0208@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


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 03/10] rust: device: Update ARef and AlwaysRefCounted imports from sync::aref
  2025-11-23  9:24 [PATCH 00/10] rust: refactor ARef and AlwaysRefCounted imports Shankari Anand
  2025-11-23  9:24 ` [PATCH 01/10] drivers: android: binder: Update ARef imports from sync::aref Shankari Anand
  2025-11-23  9:24 ` [PATCH 02/10] drivers: gpu: " Shankari Anand
@ 2025-11-23  9:24 ` Shankari Anand
  2025-11-23  9:24 ` [PATCH 04/10] rust: drm: Update AlwaysRefCounted imports to use sync::aref Shankari Anand
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 22+ messages in thread
From: Shankari Anand @ 2025-11-23  9:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Arve Hjønnevåg, Todd Kjos,
	Martijn Coenen, Joel Fernandes, Christian Brauner, Carlos Llamas,
	Suren Baghdasaryan, Danilo Krummrich, Alice Ryhl,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, Alexandre Courbot, Rafael J . Wysocki,
	Miguel Ojeda, Alex Gaynor, Igor Korotin, Michal Wilczynski
  Cc: Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
	Andreas Hindborg, Trevor Gross, Daniel Almeida, Abdiel Janulgue,
	Robin Murphy, linux-kernel, dri-devel, nouveau, rust-for-linux,
	linux-pwm, Shankari Anand

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@kernel.org>
Link: https://github.com/Rust-for-Linux/linux/issues/1173
Signed-off-by: Shankari Anand <shankari.ak0208@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


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 04/10] rust: drm: Update AlwaysRefCounted imports to use sync::aref
  2025-11-23  9:24 [PATCH 00/10] rust: refactor ARef and AlwaysRefCounted imports Shankari Anand
                   ` (2 preceding siblings ...)
  2025-11-23  9:24 ` [PATCH 03/10] rust: device: Update ARef and AlwaysRefCounted " Shankari Anand
@ 2025-11-23  9:24 ` Shankari Anand
  2025-11-23  9:24 ` [PATCH 05/10] rust: kernel: Update ARef and " Shankari Anand
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 22+ messages in thread
From: Shankari Anand @ 2025-11-23  9:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Arve Hjønnevåg, Todd Kjos,
	Martijn Coenen, Joel Fernandes, Christian Brauner, Carlos Llamas,
	Suren Baghdasaryan, Danilo Krummrich, Alice Ryhl,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, Alexandre Courbot, Rafael J . Wysocki,
	Miguel Ojeda, Alex Gaynor, Igor Korotin, Michal Wilczynski
  Cc: Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
	Andreas Hindborg, Trevor Gross, Daniel Almeida, Abdiel Janulgue,
	Robin Murphy, linux-kernel, dri-devel, nouveau, rust-for-linux,
	linux-pwm, Shankari Anand

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@kernel.org>
Link: https://github.com/Rust-for-Linux/linux/issues/1173
Signed-off-by: Shankari Anand <shankari.ak0208@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


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 05/10] rust: kernel: Update ARef and AlwaysRefCounted imports to use sync::aref
  2025-11-23  9:24 [PATCH 00/10] rust: refactor ARef and AlwaysRefCounted imports Shankari Anand
                   ` (3 preceding siblings ...)
  2025-11-23  9:24 ` [PATCH 04/10] rust: drm: Update AlwaysRefCounted imports to use sync::aref Shankari Anand
@ 2025-11-23  9:24 ` Shankari Anand
  2025-11-23 13:16   ` Igor Korotin
  2025-11-29 12:21   ` Igor Korotin
  2025-11-23  9:24 ` [PATCH 06/10] " Shankari Anand
                   ` (5 subsequent siblings)
  10 siblings, 2 replies; 22+ messages in thread
From: Shankari Anand @ 2025-11-23  9:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Arve Hjønnevåg, Todd Kjos,
	Martijn Coenen, Joel Fernandes, Christian Brauner, Carlos Llamas,
	Suren Baghdasaryan, Danilo Krummrich, Alice Ryhl,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, Alexandre Courbot, Rafael J . Wysocki,
	Miguel Ojeda, Alex Gaynor, Igor Korotin, Michal Wilczynski
  Cc: Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
	Andreas Hindborg, Trevor Gross, Daniel Almeida, Abdiel Janulgue,
	Robin Murphy, linux-kernel, dri-devel, nouveau, rust-for-linux,
	linux-pwm, Shankari Anand

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@kernel.org>
Link: https://github.com/Rust-for-Linux/linux/issues/1173
Signed-off-by: Shankari Anand <shankari.ak0208@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


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 06/10] rust: kernel: Update ARef and AlwaysRefCounted imports to use sync::aref
  2025-11-23  9:24 [PATCH 00/10] rust: refactor ARef and AlwaysRefCounted imports Shankari Anand
                   ` (4 preceding siblings ...)
  2025-11-23  9:24 ` [PATCH 05/10] rust: kernel: Update ARef and " Shankari Anand
@ 2025-11-23  9:24 ` Shankari Anand
  2025-11-24 16:10   ` Uwe Kleine-König
  2025-11-23  9:24 ` [PATCH 07/10] rust: kernel: Update ARef " Shankari Anand
                   ` (4 subsequent siblings)
  10 siblings, 1 reply; 22+ messages in thread
From: Shankari Anand @ 2025-11-23  9:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Arve Hjønnevåg, Todd Kjos,
	Martijn Coenen, Joel Fernandes, Christian Brauner, Carlos Llamas,
	Suren Baghdasaryan, Danilo Krummrich, Alice Ryhl,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, Alexandre Courbot, Rafael J . Wysocki,
	Miguel Ojeda, Alex Gaynor, Igor Korotin, Michal Wilczynski
  Cc: Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
	Andreas Hindborg, Trevor Gross, Daniel Almeida, Abdiel Janulgue,
	Robin Murphy, linux-kernel, dri-devel, nouveau, rust-for-linux,
	linux-pwm, Shankari Anand

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@kernel.org>
Link: https://github.com/Rust-for-Linux/linux/issues/1173
Signed-off-by: Shankari Anand <shankari.ak0208@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


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 07/10] rust: kernel: Update ARef imports to use sync::aref
  2025-11-23  9:24 [PATCH 00/10] rust: refactor ARef and AlwaysRefCounted imports Shankari Anand
                   ` (5 preceding siblings ...)
  2025-11-23  9:24 ` [PATCH 06/10] " Shankari Anand
@ 2025-11-23  9:24 ` Shankari Anand
  2025-11-23  9:24 ` [PATCH 08/10] rust: kernel: Update AlwaysRefCounted " Shankari Anand
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 22+ messages in thread
From: Shankari Anand @ 2025-11-23  9:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Arve Hjønnevåg, Todd Kjos,
	Martijn Coenen, Joel Fernandes, Christian Brauner, Carlos Llamas,
	Suren Baghdasaryan, Danilo Krummrich, Alice Ryhl,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, Alexandre Courbot, Rafael J . Wysocki,
	Miguel Ojeda, Alex Gaynor, Igor Korotin, Michal Wilczynski
  Cc: Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
	Andreas Hindborg, Trevor Gross, Daniel Almeida, Abdiel Janulgue,
	Robin Murphy, linux-kernel, dri-devel, nouveau, rust-for-linux,
	linux-pwm, Shankari Anand

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@kernel.org>
Link: https://github.com/Rust-for-Linux/linux/issues/1173
Signed-off-by: Shankari Anand <shankari.ak0208@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


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 08/10] rust: kernel: Update AlwaysRefCounted imports to use sync::aref
  2025-11-23  9:24 [PATCH 00/10] rust: refactor ARef and AlwaysRefCounted imports Shankari Anand
                   ` (6 preceding siblings ...)
  2025-11-23  9:24 ` [PATCH 07/10] rust: kernel: Update ARef " Shankari Anand
@ 2025-11-23  9:24 ` Shankari Anand
  2025-11-23  9:24 ` [PATCH 09/10] samples: rust: Update ARef " Shankari Anand
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 22+ messages in thread
From: Shankari Anand @ 2025-11-23  9:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Arve Hjønnevåg, Todd Kjos,
	Martijn Coenen, Joel Fernandes, Christian Brauner, Carlos Llamas,
	Suren Baghdasaryan, Danilo Krummrich, Alice Ryhl,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, Alexandre Courbot, Rafael J . Wysocki,
	Miguel Ojeda, Alex Gaynor, Igor Korotin, Michal Wilczynski
  Cc: Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
	Andreas Hindborg, Trevor Gross, Daniel Almeida, Abdiel Janulgue,
	Robin Murphy, linux-kernel, dri-devel, nouveau, rust-for-linux,
	linux-pwm, Shankari Anand

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@kernel.org>
Link: https://github.com/Rust-for-Linux/linux/issues/1173
Signed-off-by: Shankari Anand <shankari.ak0208@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


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 09/10] samples: rust: Update ARef imports to use sync::aref
  2025-11-23  9:24 [PATCH 00/10] rust: refactor ARef and AlwaysRefCounted imports Shankari Anand
                   ` (7 preceding siblings ...)
  2025-11-23  9:24 ` [PATCH 08/10] rust: kernel: Update AlwaysRefCounted " Shankari Anand
@ 2025-11-23  9:24 ` Shankari Anand
  2025-11-23  9:24 ` [PATCH 10/10] rust: kernel: remove temporary re-exports of ARef and AlwaysRefCounted Shankari Anand
  2025-11-25 12:39 ` [PATCH 00/10] rust: refactor ARef and AlwaysRefCounted imports Alice Ryhl
  10 siblings, 0 replies; 22+ messages in thread
From: Shankari Anand @ 2025-11-23  9:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Arve Hjønnevåg, Todd Kjos,
	Martijn Coenen, Joel Fernandes, Christian Brauner, Carlos Llamas,
	Suren Baghdasaryan, Danilo Krummrich, Alice Ryhl,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, Alexandre Courbot, Rafael J . Wysocki,
	Miguel Ojeda, Alex Gaynor, Igor Korotin, Michal Wilczynski
  Cc: Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
	Andreas Hindborg, Trevor Gross, Daniel Almeida, Abdiel Janulgue,
	Robin Murphy, linux-kernel, dri-devel, nouveau, rust-for-linux,
	linux-pwm, Shankari Anand

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@kernel.org>
Link: https://github.com/Rust-for-Linux/linux/issues/1173
Signed-off-by: Shankari Anand <shankari.ak0208@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


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 10/10] rust: kernel: remove temporary re-exports of ARef and AlwaysRefCounted
  2025-11-23  9:24 [PATCH 00/10] rust: refactor ARef and AlwaysRefCounted imports Shankari Anand
                   ` (8 preceding siblings ...)
  2025-11-23  9:24 ` [PATCH 09/10] samples: rust: Update ARef " Shankari Anand
@ 2025-11-23  9:24 ` Shankari Anand
  2025-11-25 12:39 ` [PATCH 00/10] rust: refactor ARef and AlwaysRefCounted imports Alice Ryhl
  10 siblings, 0 replies; 22+ messages in thread
From: Shankari Anand @ 2025-11-23  9:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Arve Hjønnevåg, Todd Kjos,
	Martijn Coenen, Joel Fernandes, Christian Brauner, Carlos Llamas,
	Suren Baghdasaryan, Danilo Krummrich, Alice Ryhl,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, Alexandre Courbot, Rafael J . Wysocki,
	Miguel Ojeda, Alex Gaynor, Igor Korotin, Michal Wilczynski
  Cc: Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
	Andreas Hindborg, Trevor Gross, Daniel Almeida, Abdiel Janulgue,
	Robin Murphy, linux-kernel, dri-devel, nouveau, rust-for-linux,
	linux-pwm, Shankari Anand

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@kernel.org>
Link: https://github.com/Rust-for-Linux/linux/issues/1173
Signed-off-by: Shankari Anand <shankari.ak0208@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


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* Re: [PATCH 05/10] rust: kernel: Update ARef and AlwaysRefCounted imports to use sync::aref
  2025-11-23  9:24 ` [PATCH 05/10] rust: kernel: Update ARef and " Shankari Anand
@ 2025-11-23 13:16   ` Igor Korotin
  2025-11-29 12:21   ` Igor Korotin
  1 sibling, 0 replies; 22+ messages in thread
From: Igor Korotin @ 2025-11-23 13:16 UTC (permalink / raw)
  To: Shankari Anand, Greg Kroah-Hartman, Arve Hjønnevåg,
	Todd Kjos, Martijn Coenen, Joel Fernandes, Christian Brauner,
	Carlos Llamas, Suren Baghdasaryan, Danilo Krummrich, Alice Ryhl,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, Alexandre Courbot, Rafael J . Wysocki,
	Miguel Ojeda, Alex Gaynor, Michal Wilczynski
  Cc: Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
	Andreas Hindborg, Trevor Gross, Daniel Almeida, Abdiel Janulgue,
	Robin Murphy, linux-kernel, dri-devel, nouveau, rust-for-linux,
	linux-pwm

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@kernel.org>
> Link: https://github.com/Rust-for-Linux/linux/issues/1173
> Signed-off-by: Shankari Anand <shankari.ak0208@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

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 02/10] drivers: gpu: Update ARef imports from sync::aref
  2025-11-23  9:24 ` [PATCH 02/10] drivers: gpu: " Shankari Anand
@ 2025-11-24 12:16   ` Alexandre Courbot
  2025-11-24 21:20   ` Joel Fernandes
  1 sibling, 0 replies; 22+ messages in thread
From: Alexandre Courbot @ 2025-11-24 12:16 UTC (permalink / raw)
  To: Shankari Anand, Greg Kroah-Hartman, Arve Hjønnevåg,
	Todd Kjos, Martijn Coenen, Joel Fernandes, Christian Brauner,
	Carlos Llamas, Suren Baghdasaryan, Danilo Krummrich, Alice Ryhl,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, Alexandre Courbot, Rafael J . Wysocki,
	Miguel Ojeda, Alex Gaynor, Igor Korotin, Michal Wilczynski
  Cc: Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
	Andreas Hindborg, Trevor Gross, Daniel Almeida, Abdiel Janulgue,
	Robin Murphy, linux-kernel, dri-devel, nouveau, rust-for-linux,
	linux-pwm, dri-devel

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@kernel.org>
> Link: https://github.com/Rust-for-Linux/linux/issues/1173
> Signed-off-by: Shankari Anand <shankari.ak0208@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@nvidia.com>

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 06/10] rust: kernel: Update ARef and AlwaysRefCounted imports to use sync::aref
  2025-11-23  9:24 ` [PATCH 06/10] " Shankari Anand
@ 2025-11-24 16:10   ` Uwe Kleine-König
  2025-11-25 12:31     ` Miguel Ojeda
  0 siblings, 1 reply; 22+ messages in thread
From: Uwe Kleine-König @ 2025-11-24 16:10 UTC (permalink / raw)
  To: Shankari Anand
  Cc: Greg Kroah-Hartman, Arve Hjønnevåg, Todd Kjos,
	Martijn Coenen, Joel Fernandes, Christian Brauner, Carlos Llamas,
	Suren Baghdasaryan, Danilo Krummrich, Alice Ryhl,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, Alexandre Courbot, Rafael J . Wysocki,
	Miguel Ojeda, Alex Gaynor, Igor Korotin, Michal Wilczynski,
	Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
	Andreas Hindborg, Trevor Gross, Daniel Almeida, Abdiel Janulgue,
	Robin Murphy, linux-kernel, dri-devel, nouveau, rust-for-linux,
	linux-pwm

[-- Attachment #1: Type: text/plain, Size: 1289 bytes --]

Hello,

I suggest $Subject ~= s/kernel/pwm/.

On Sun, Nov 23, 2025 at 02:54:34PM +0530, Shankari Anand wrote:
> 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@kernel.org>
> Link: https://github.com/Rust-for-Linux/linux/issues/1173
> Signed-off-by: Shankari Anand <shankari.ak0208@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};

having no clue about Rust:

Can this patch be applied independent of the others via the pwm tree? If
I understand correctly it's only patch #10 that depends on the previous
patches, right?

Is there already a merge plan for this series?

Best regards
Uwe

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 02/10] drivers: gpu: Update ARef imports from sync::aref
  2025-11-23  9:24 ` [PATCH 02/10] drivers: gpu: " Shankari Anand
  2025-11-24 12:16   ` Alexandre Courbot
@ 2025-11-24 21:20   ` Joel Fernandes
  1 sibling, 0 replies; 22+ messages in thread
From: Joel Fernandes @ 2025-11-24 21:20 UTC (permalink / raw)
  To: Shankari Anand, Greg Kroah-Hartman, Arve Hjønnevåg,
	Todd Kjos, Martijn Coenen, Christian Brauner, Carlos Llamas,
	Suren Baghdasaryan, Danilo Krummrich, Alice Ryhl,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, Alexandre Courbot, Rafael J . Wysocki,
	Miguel Ojeda, Alex Gaynor, Igor Korotin, Michal Wilczynski
  Cc: Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
	Andreas Hindborg, Trevor Gross, Daniel Almeida, Abdiel Janulgue,
	Robin Murphy, linux-kernel, dri-devel, nouveau, rust-for-linux,
	linux-pwm



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@kernel.org>
> Link: https://github.com/Rust-for-Linux/linux/issues/1173
> Signed-off-by: Shankari Anand <shankari.ak0208@gmail.com>

Reviewed-by: Joel Fernandes <joelagnelf@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::{


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 01/10] drivers: android: binder: Update ARef imports from sync::aref
  2025-11-23  9:24 ` [PATCH 01/10] drivers: android: binder: Update ARef imports from sync::aref Shankari Anand
@ 2025-11-25 12:24   ` Alice Ryhl
  0 siblings, 0 replies; 22+ messages in thread
From: Alice Ryhl @ 2025-11-25 12:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Shankari Anand, Arve Hjønnevåg, Todd Kjos,
	Martijn Coenen, Joel Fernandes, Christian Brauner, Carlos Llamas,
	Suren Baghdasaryan, Danilo Krummrich, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
	Alexandre Courbot, Rafael J . Wysocki, Miguel Ojeda, Alex Gaynor,
	Igor Korotin, Michal Wilczynski, Boqun Feng, Gary Guo,
	Björn Roy Baron, Benno Lossin, Andreas Hindborg,
	Trevor Gross, Daniel Almeida, Abdiel Janulgue, Robin Murphy,
	linux-kernel, dri-devel, nouveau, rust-for-linux, linux-pwm

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@kernel.org>
> Link: https://github.com/Rust-for-Linux/linux/issues/1173
> Signed-off-by: Shankari Anand <shankari.ak0208@gmail.com>

Greg, please go ahead and pick up this one, thanks!

Acked-by: Alice Ryhl <aliceryhl@google.com>


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 06/10] rust: kernel: Update ARef and AlwaysRefCounted imports to use sync::aref
  2025-11-24 16:10   ` Uwe Kleine-König
@ 2025-11-25 12:31     ` Miguel Ojeda
  2025-11-26 11:34       ` Michal Wilczynski
  0 siblings, 1 reply; 22+ messages in thread
From: Miguel Ojeda @ 2025-11-25 12:31 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Shankari Anand, Greg Kroah-Hartman, Arve Hjønnevåg,
	Todd Kjos, Martijn Coenen, Joel Fernandes, Christian Brauner,
	Carlos Llamas, Suren Baghdasaryan, Danilo Krummrich, Alice Ryhl,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, Alexandre Courbot, Rafael J . Wysocki,
	Miguel Ojeda, Alex Gaynor, Igor Korotin, Michal Wilczynski,
	Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
	Andreas Hindborg, Trevor Gross, Daniel Almeida, Abdiel Janulgue,
	Robin Murphy, linux-kernel, dri-devel, nouveau, rust-for-linux,
	linux-pwm

On Mon, Nov 24, 2025 at 5:10 PM Uwe Kleine-König
<u.kleine-koenig@baylibre.com> wrote:
>
> having no clue about Rust:
>
> Can this patch be applied independent of the others via the pwm tree? If
> I understand correctly it's only patch #10 that depends on the previous
> patches, right?
>
> Is there already a merge plan for this series?

Yeah, if subsystems pick the independent patches at their own pace,
then that is great, so please do!

Then, after 1 or 2 cycles, we can do the flag day change on the Rust
tree (with any last changes needed Ack'd, but ideally there will be
none remaining).

It is what did in similar cases for renaming (or moving across the
path hierarchy) things in Rust. For simple things that get Ack'd quick
enough by everyone, sometimes we may be able to take everything in the
Rust tree.

Thanks!

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 00/10] rust: refactor ARef and AlwaysRefCounted imports
  2025-11-23  9:24 [PATCH 00/10] rust: refactor ARef and AlwaysRefCounted imports Shankari Anand
                   ` (9 preceding siblings ...)
  2025-11-23  9:24 ` [PATCH 10/10] rust: kernel: remove temporary re-exports of ARef and AlwaysRefCounted Shankari Anand
@ 2025-11-25 12:39 ` Alice Ryhl
  10 siblings, 0 replies; 22+ messages in thread
From: Alice Ryhl @ 2025-11-25 12:39 UTC (permalink / raw)
  To: Shankari Anand
  Cc: Greg Kroah-Hartman, Arve Hjønnevåg, Todd Kjos,
	Martijn Coenen, Joel Fernandes, Christian Brauner, Carlos Llamas,
	Suren Baghdasaryan, Danilo Krummrich, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
	Alexandre Courbot, Rafael J . Wysocki, Miguel Ojeda, Alex Gaynor,
	Igor Korotin, Michal Wilczynski, Boqun Feng, Gary Guo,
	Björn Roy Baron, Benno Lossin, Andreas Hindborg,
	Trevor Gross, Daniel Almeida, Abdiel Janulgue, Robin Murphy,
	linux-kernel, dri-devel, nouveau, rust-for-linux, linux-pwm

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@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

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 06/10] rust: kernel: Update ARef and AlwaysRefCounted imports to use sync::aref
  2025-11-25 12:31     ` Miguel Ojeda
@ 2025-11-26 11:34       ` Michal Wilczynski
  2025-11-27  6:25         ` Uwe Kleine-König
  0 siblings, 1 reply; 22+ messages in thread
From: Michal Wilczynski @ 2025-11-26 11:34 UTC (permalink / raw)
  To: Miguel Ojeda, Uwe Kleine-König
  Cc: Shankari Anand, Greg Kroah-Hartman, Arve Hjønnevåg,
	Todd Kjos, Martijn Coenen, Joel Fernandes, Christian Brauner,
	Carlos Llamas, Suren Baghdasaryan, Danilo Krummrich, Alice Ryhl,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, Alexandre Courbot, Rafael J . Wysocki,
	Miguel Ojeda, Alex Gaynor, Igor Korotin, Boqun Feng, Gary Guo,
	Björn Roy Baron, Benno Lossin, Andreas Hindborg,
	Trevor Gross, Daniel Almeida, Abdiel Janulgue, Robin Murphy,
	linux-kernel, dri-devel, nouveau, rust-for-linux, linux-pwm



On 11/25/25 13:31, Miguel Ojeda wrote:
> On Mon, Nov 24, 2025 at 5:10 PM Uwe Kleine-König
> <u.kleine-koenig@baylibre.com> wrote:
>>
>> having no clue about Rust:
>>
>> Can this patch be applied independent of the others via the pwm tree? If
>> I understand correctly it's only patch #10 that depends on the previous
>> patches, right?
>>
>> Is there already a merge plan for this series?
> 
> Yeah, if subsystems pick the independent patches at their own pace,
> then that is great, so please do!
> 
> Then, after 1 or 2 cycles, we can do the flag day change on the Rust
> tree (with any last changes needed Ack'd, but ideally there will be
> none remaining).
> 
> It is what did in similar cases for renaming (or moving across the
> path hierarchy) things in Rust. For simple things that get Ack'd quick
> enough by everyone, sometimes we may be able to take everything in the
> Rust tree.
> 
> Thanks!
> 
> Cheers,
> Miguel
> 

I think code wise it's fine, provided the subject is fixed like Uwe suggested.

Acked-by: Michal Wilczynski <m.wilczynski@samsung.com>

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 06/10] rust: kernel: Update ARef and AlwaysRefCounted imports to use sync::aref
  2025-11-26 11:34       ` Michal Wilczynski
@ 2025-11-27  6:25         ` Uwe Kleine-König
  0 siblings, 0 replies; 22+ messages in thread
From: Uwe Kleine-König @ 2025-11-27  6:25 UTC (permalink / raw)
  To: Michal Wilczynski
  Cc: Miguel Ojeda, Shankari Anand, Greg Kroah-Hartman,
	Arve Hjønnevåg, Todd Kjos, Martijn Coenen,
	Joel Fernandes, Christian Brauner, Carlos Llamas,
	Suren Baghdasaryan, Danilo Krummrich, Alice Ryhl,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, Alexandre Courbot, Rafael J . Wysocki,
	Miguel Ojeda, Alex Gaynor, Igor Korotin, Boqun Feng, Gary Guo,
	Björn Roy Baron, Benno Lossin, Andreas Hindborg,
	Trevor Gross, Daniel Almeida, Abdiel Janulgue, Robin Murphy,
	linux-kernel, dri-devel, nouveau, rust-for-linux, linux-pwm

[-- Attachment #1: Type: text/plain, Size: 1693 bytes --]

Hello,

On Wed, Nov 26, 2025 at 12:34:23PM +0100, Michal Wilczynski wrote:
> On 11/25/25 13:31, Miguel Ojeda wrote:
> > On Mon, Nov 24, 2025 at 5:10 PM Uwe Kleine-König
> > <u.kleine-koenig@baylibre.com> wrote:
> >>
> >> having no clue about Rust:
> >>
> >> Can this patch be applied independent of the others via the pwm tree? If
> >> I understand correctly it's only patch #10 that depends on the previous
> >> patches, right?
> >>
> >> Is there already a merge plan for this series?
> > 
> > Yeah, if subsystems pick the independent patches at their own pace,
> > then that is great, so please do!
> > 
> > Then, after 1 or 2 cycles, we can do the flag day change on the Rust
> > tree (with any last changes needed Ack'd, but ideally there will be
> > none remaining).
> > 
> > It is what did in similar cases for renaming (or moving across the
> > path hierarchy) things in Rust. For simple things that get Ack'd quick
> > enough by everyone, sometimes we may be able to take everything in the
> > Rust tree.
> 
> I think code wise it's fine, provided the subject is fixed like Uwe suggested.
> 
> Acked-by: Michal Wilczynski <m.wilczynski@samsung.com>

OK, I applied it to

	https://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux.git pwm/for-nexxt

. I will rebase this branch to v6.19-rc1 once that's released and then
send it to Linus for v6.20-rc1 (assuming he has so many fingers and toes
to not switch to 7.0 before :-).

If it turns out to go in via the rust tree, tell me, then I'll drop it.
In that case take my

Acked-by: Uwe Kleine-König <ukleinek@kernel.org>

Best regards and thanks for the patch and the reviews,
Uwe

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 05/10] rust: kernel: Update ARef and AlwaysRefCounted imports to use sync::aref
  2025-11-23  9:24 ` [PATCH 05/10] rust: kernel: Update ARef and " Shankari Anand
  2025-11-23 13:16   ` Igor Korotin
@ 2025-11-29 12:21   ` Igor Korotin
  2025-12-05 18:40     ` Shankari Anand
  1 sibling, 1 reply; 22+ messages in thread
From: Igor Korotin @ 2025-11-29 12:21 UTC (permalink / raw)
  To: Shankari Anand, Greg Kroah-Hartman, Arve Hjønnevåg,
	Todd Kjos, Martijn Coenen, Joel Fernandes, Christian Brauner,
	Carlos Llamas, Suren Baghdasaryan, Danilo Krummrich, Alice Ryhl,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, Alexandre Courbot, Rafael J . Wysocki,
	Miguel Ojeda, Alex Gaynor, Michal Wilczynski
  Cc: Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
	Andreas Hindborg, Trevor Gross, Daniel Almeida, Abdiel Janulgue,
	Robin Murphy, linux-kernel, dri-devel, nouveau, rust-for-linux,
	linux-pwm

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@kernel.org>
> Link: https://github.com/Rust-for-Linux/linux/issues/1173
> Signed-off-by: Shankari Anand <shankari.ak0208@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@gmail.com>

Thanks

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 05/10] rust: kernel: Update ARef and AlwaysRefCounted imports to use sync::aref
  2025-11-29 12:21   ` Igor Korotin
@ 2025-12-05 18:40     ` Shankari Anand
  0 siblings, 0 replies; 22+ messages in thread
From: Shankari Anand @ 2025-12-05 18:40 UTC (permalink / raw)
  To: Igor Korotin
  Cc: Greg Kroah-Hartman, Arve Hjønnevåg, Todd Kjos,
	Martijn Coenen, Joel Fernandes, Christian Brauner, Carlos Llamas,
	Suren Baghdasaryan, Danilo Krummrich, Alice Ryhl,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, Alexandre Courbot, Rafael J . Wysocki,
	Miguel Ojeda, Alex Gaynor, Michal Wilczynski, Boqun Feng,
	Gary Guo, Björn Roy Baron, Benno Lossin, Andreas Hindborg,
	Trevor Gross, Daniel Almeida, Abdiel Janulgue, Robin Murphy,
	Shankari Anand, linux-kernel, dri-devel, nouveau, rust-for-linux,
	linux-pwm

Hello Igor,

> 
> 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

I apologize for the overlook. I was just focussing on changing the path. 
I'll make the required changes and send a v2.

As this patch is part of a series, am I supposed to send all the patches with a v2, 
some have been acked by already, hence I had the question?

Thanks and regards,
Shankari

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2025-12-05 18:40 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-23  9:24 [PATCH 00/10] rust: refactor ARef and AlwaysRefCounted imports Shankari Anand
2025-11-23  9:24 ` [PATCH 01/10] drivers: android: binder: Update ARef imports from sync::aref Shankari Anand
2025-11-25 12:24   ` Alice Ryhl
2025-11-23  9:24 ` [PATCH 02/10] drivers: gpu: " Shankari Anand
2025-11-24 12:16   ` Alexandre Courbot
2025-11-24 21:20   ` Joel Fernandes
2025-11-23  9:24 ` [PATCH 03/10] rust: device: Update ARef and AlwaysRefCounted " Shankari Anand
2025-11-23  9:24 ` [PATCH 04/10] rust: drm: Update AlwaysRefCounted imports to use sync::aref Shankari Anand
2025-11-23  9:24 ` [PATCH 05/10] rust: kernel: Update ARef and " Shankari Anand
2025-11-23 13:16   ` Igor Korotin
2025-11-29 12:21   ` Igor Korotin
2025-12-05 18:40     ` Shankari Anand
2025-11-23  9:24 ` [PATCH 06/10] " Shankari Anand
2025-11-24 16:10   ` Uwe Kleine-König
2025-11-25 12:31     ` Miguel Ojeda
2025-11-26 11:34       ` Michal Wilczynski
2025-11-27  6:25         ` Uwe Kleine-König
2025-11-23  9:24 ` [PATCH 07/10] rust: kernel: Update ARef " Shankari Anand
2025-11-23  9:24 ` [PATCH 08/10] rust: kernel: Update AlwaysRefCounted " Shankari Anand
2025-11-23  9:24 ` [PATCH 09/10] samples: rust: Update ARef " Shankari Anand
2025-11-23  9:24 ` [PATCH 10/10] rust: kernel: remove temporary re-exports of ARef and AlwaysRefCounted Shankari Anand
2025-11-25 12:39 ` [PATCH 00/10] rust: refactor ARef and AlwaysRefCounted imports Alice Ryhl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).