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 <[email protected]>
Link: https://github.com/Rust-for-Linux/linux/issues/1173
Signed-off-by: Shankari Anand <[email protected]>
---
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 <[email protected]>
Thanks