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
Shankari Anand
2025-Dec-05 18:40 UTC
[PATCH 05/10] rust: kernel: Update ARef and AlwaysRefCounted imports to use sync::aref
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 > IgorI 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