mirror of
https://github.com/torvalds/linux.git
synced 2026-05-31 10:33:41 +02:00
rust: i2c: 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@kernel.org> Link: https://github.com/Rust-for-Linux/linux/issues/1173 Signed-off-by: Shankari Anand <shankari.ak0208@gmail.com> Acked-by: Igor Korotin <igor.korotin.linux@gmail.com> Link: https://patch.msgid.link/20260102202714.184223-3-shankari.ak0208@gmail.com [ Move `ARef` import into the `kernel` `use` tree above. - Miguel ] Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
This commit is contained in:
parent
1353b8f32c
commit
dfce283387
|
|
@ -16,10 +16,11 @@
|
|||
error::*,
|
||||
of,
|
||||
prelude::*,
|
||||
types::{
|
||||
AlwaysRefCounted,
|
||||
Opaque, //
|
||||
}, //
|
||||
sync::aref::{
|
||||
ARef,
|
||||
AlwaysRefCounted, //
|
||||
},
|
||||
types::Opaque, //
|
||||
};
|
||||
|
||||
use core::{
|
||||
|
|
@ -31,8 +32,6 @@
|
|||
}, //
|
||||
};
|
||||
|
||||
use kernel::types::ARef;
|
||||
|
||||
/// An I2C device id table.
|
||||
#[repr(transparent)]
|
||||
#[derive(Clone, Copy)]
|
||||
|
|
@ -416,7 +415,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 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()) };
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user