Re: [PATCH v2 5/8] rust: samples: i2c: remove redundant `.as_ref()` for `dev_*` print

From: Igor Korotin

Date: Tue Jan 27 2026 - 13:58:33 EST


Hi

On 1/23/2026 5:58 PM, Gary Guo wrote:
From: Gary Guo <gary@xxxxxxxxxxx>

This is now handled by the macro itself.

Signed-off-by: Gary Guo <gary@xxxxxxxxxxx>
---
samples/rust/rust_driver_i2c.rs | 10 ++++------
samples/rust/rust_i2c_client.rs | 10 ++--------
2 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/samples/rust/rust_driver_i2c.rs b/samples/rust/rust_driver_i2c.rs
index 6be79f9e9fb5..3079d57fe473 100644
--- a/samples/rust/rust_driver_i2c.rs
+++ b/samples/rust/rust_driver_i2c.rs
@@ -44,23 +44,21 @@ fn probe(
idev: &i2c::I2cClient<Core>,
info: Option<&Self::IdInfo>,
) -> impl PinInit<Self, Error> {
- let dev = idev.as_ref();
-
- dev_info!(dev, "Probe Rust I2C driver sample.\n");
+ dev_info!(idev, "Probe Rust I2C driver sample.\n");
if let Some(info) = info {
- dev_info!(dev, "Probed with info: '{}'.\n", info);
+ dev_info!(idev, "Probed with info: '{}'.\n", info);
}
Ok(Self)
}
fn shutdown(idev: &i2c::I2cClient<Core>, _this: Pin<&Self>) {
- dev_info!(idev.as_ref(), "Shutdown Rust I2C driver sample.\n");
+ dev_info!(idev, "Shutdown Rust I2C driver sample.\n");
}
fn unbind(idev: &i2c::I2cClient<Core>, _this: Pin<&Self>) {
- dev_info!(idev.as_ref(), "Unbind Rust I2C driver sample.\n");
+ dev_info!(idev, "Unbind Rust I2C driver sample.\n");
}
}
diff --git a/samples/rust/rust_i2c_client.rs b/samples/rust/rust_i2c_client.rs
index 8d2c12e535b0..72da5499f150 100644
--- a/samples/rust/rust_i2c_client.rs
+++ b/samples/rust/rust_i2c_client.rs
@@ -113,10 +113,7 @@ fn probe(
pdev: &platform::Device<device::Core>,
_info: Option<&Self::IdInfo>,
) -> impl PinInit<Self, Error> {
- dev_info!(
- pdev.as_ref(),
- "Probe Rust I2C Client registration sample.\n"
- );
+ dev_info!(pdev, "Probe Rust I2C Client registration sample.\n");
kernel::try_pin_init!( Self {
parent_dev: pdev.into(),
@@ -130,10 +127,7 @@ fn probe(
}
fn unbind(pdev: &platform::Device<device::Core>, _this: Pin<&Self>) {
- dev_info!(
- pdev.as_ref(),
- "Unbind Rust I2C Client registration sample.\n"
- );
+ dev_info!(pdev, "Unbind Rust I2C Client registration sample.\n");
}
}

Acked-by: Igor Korotin <igor.korotin.linux@xxxxxxxxx>

Thanks
Igor