[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2b0a1123-ad70-42ff-b5b7-088bf195080d@linux.dev>
Date: Tue, 27 Jan 2026 18:51:38 +0000
From: Igor Korotin <igor.korotin@...ux.dev>
To: Gary Guo <gary@...yguo.net>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J. Wysocki" <rafael@...nel.org>, Danilo Krummrich <dakr@...nel.org>,
Miguel Ojeda <ojeda@...nel.org>, Boqun Feng <boqun.feng@...il.com>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <lossin@...nel.org>, Andreas Hindborg <a.hindborg@...nel.org>,
Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Krzysztof Wilczyński <kwilczynski@...nel.org>,
Abdiel Janulgue <abdiel.janulgue@...il.com>,
Daniel Almeida <daniel.almeida@...labora.com>,
Robin Murphy <robin.murphy@....com>, Dave Ertman <david.m.ertman@...el.com>,
Ira Weiny <ira.weiny@...el.com>, Leon Romanovsky <leon@...nel.org>,
Igor Korotin <igor.korotin.linux@...il.com>
Cc: rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-pci@...r.kernel.org
Subject: Re: [PATCH 2/4] rust: samples: remove redundant `.as_ref()` for
`dev_*` print
Hi
On 1/20/2026 6:11 PM, Gary Guo wrote:
> From: Gary Guo <gary@...yguo.net>
>
> This is now handled by the macro itself.
>
> Signed-off-by: Gary Guo <gary@...yguo.net>
> ---
> samples/rust/rust_dma.rs | 2 +-
> samples/rust/rust_driver_auxiliary.rs | 2 +-
> samples/rust/rust_driver_faux.rs | 2 +-
> samples/rust/rust_driver_i2c.rs | 4 ++--
> samples/rust/rust_driver_pci.rs | 6 +++---
> samples/rust/rust_driver_platform.rs | 2 +-
> samples/rust/rust_i2c_client.rs | 10 ++--------
> 7 files changed, 11 insertions(+), 17 deletions(-)
>
> diff --git a/samples/rust/rust_dma.rs b/samples/rust/rust_dma.rs
> index f53bce2a73e3..a9ac7937ebaf 100644
> --- a/samples/rust/rust_dma.rs
> +++ b/samples/rust/rust_dma.rs
> @@ -57,7 +57,7 @@ impl pci::Driver for DmaSampleDriver {
>
> fn probe(pdev: &pci::Device<Core>, _info: &Self::IdInfo) -> impl PinInit<Self, Error> {
> pin_init::pin_init_scope(move || {
> - dev_info!(pdev.as_ref(), "Probe DMA test driver.\n");
> + dev_info!(pdev, "Probe DMA test driver.\n");
>
> let mask = DmaMask::new::<64>();
>
> diff --git a/samples/rust/rust_driver_auxiliary.rs b/samples/rust/rust_driver_auxiliary.rs
> index f148124fe81f..c20961f16835 100644
> --- a/samples/rust/rust_driver_auxiliary.rs
> +++ b/samples/rust/rust_driver_auxiliary.rs
> @@ -39,7 +39,7 @@ impl auxiliary::Driver for AuxiliaryDriver {
>
> fn probe(adev: &auxiliary::Device<Core>, _info: &Self::IdInfo) -> impl PinInit<Self, Error> {
> dev_info!(
> - adev.as_ref(),
> + adev,
> "Probing auxiliary driver for auxiliary device with id={}\n",
> adev.id()
> );
> diff --git a/samples/rust/rust_driver_faux.rs b/samples/rust/rust_driver_faux.rs
> index 5330b77ea986..99876c8e3743 100644
> --- a/samples/rust/rust_driver_faux.rs
> +++ b/samples/rust/rust_driver_faux.rs
> @@ -26,7 +26,7 @@ fn init(_module: &'static ThisModule) -> Result<Self> {
>
> let reg = faux::Registration::new(c"rust-faux-sample-device", None)?;
>
> - dev_info!(reg.as_ref(), "Hello from faux device!\n");
> + dev_info!(reg, "Hello from faux device!\n");
>
> Ok(Self { _reg: reg })
> }
> diff --git a/samples/rust/rust_driver_i2c.rs b/samples/rust/rust_driver_i2c.rs
> index 6be79f9e9fb5..e71b77196163 100644
> --- a/samples/rust/rust_driver_i2c.rs
> +++ b/samples/rust/rust_driver_i2c.rs
> @@ -56,11 +56,11 @@ fn probe(
> }
>
> 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_driver_pci.rs b/samples/rust/rust_driver_pci.rs
> index ef04c6401e6a..d50828b642e5 100644
> --- a/samples/rust/rust_driver_pci.rs
> +++ b/samples/rust/rust_driver_pci.rs
> @@ -75,7 +75,7 @@ fn probe(pdev: &pci::Device<Core>, info: &Self::IdInfo) -> impl PinInit<Self, Er
> pin_init::pin_init_scope(move || {
> let vendor = pdev.vendor_id();
> dev_dbg!(
> - pdev.as_ref(),
> + pdev,
> "Probe Rust PCI driver sample (PCI ID: {}, 0x{:x}).\n",
> vendor,
> pdev.device_id()
> @@ -91,7 +91,7 @@ fn probe(pdev: &pci::Device<Core>, info: &Self::IdInfo) -> impl PinInit<Self, Er
> let bar = bar.access(pdev.as_ref())?;
>
> dev_info!(
> - pdev.as_ref(),
> + pdev,
> "pci-testdev data-match count: {}\n",
> Self::testdev(info, bar)?
> );
> @@ -112,7 +112,7 @@ fn unbind(pdev: &pci::Device<Core>, this: Pin<&Self>) {
> #[pinned_drop]
> impl PinnedDrop for SampleDriver {
> fn drop(self: Pin<&mut Self>) {
> - dev_dbg!(self.pdev.as_ref(), "Remove Rust PCI driver sample.\n");
> + dev_dbg!(self.pdev, "Remove Rust PCI driver sample.\n");
> }
> }
>
> diff --git a/samples/rust/rust_driver_platform.rs b/samples/rust/rust_driver_platform.rs
> index 9537dc38c563..f2229d176fb9 100644
> --- a/samples/rust/rust_driver_platform.rs
> +++ b/samples/rust/rust_driver_platform.rs
> @@ -180,7 +180,7 @@ fn properties_parse(dev: &device::Device) -> Result {
>
> impl Drop for SampleDriver {
> fn drop(&mut self) {
> - dev_dbg!(self.pdev.as_ref(), "Remove Rust Platform driver sample.\n");
> + dev_dbg!(self.pdev, "Remove Rust Platform 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@...il.com>
Thanks
Igor
Powered by blists - more mailing lists