From: Danilo Krummrich Date: Fri, 20 Jun 2025 15:18:49 +0000 (+0100) Subject: samples: rust: platform: don't call as_ref() repeatedly X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c69072d3a10976e48da97758a78c35305c24eeba;p=thirdparty%2Fkernel%2Fstable.git samples: rust: platform: don't call as_ref() repeatedly In SampleDriver::probe() don't call pdev.as_ref() repeatedly, instead introduce a dedicated &Device. Signed-off-by: Igor Korotin Reviewed-by: Dirk Behme Link: https://lore.kernel.org/r/20250620151849.281238-1-igor.korotin.linux@gmail.com Signed-off-by: Danilo Krummrich --- diff --git a/samples/rust/rust_driver_platform.rs b/samples/rust/rust_driver_platform.rs index 4dcedb22a4bb..db2edcd49a48 100644 --- a/samples/rust/rust_driver_platform.rs +++ b/samples/rust/rust_driver_platform.rs @@ -36,13 +36,15 @@ impl platform::Driver for SampleDriver { pdev: &platform::Device, info: Option<&Self::IdInfo>, ) -> Result>> { - dev_dbg!(pdev.as_ref(), "Probe Rust Platform driver sample.\n"); + let dev = pdev.as_ref(); + + dev_dbg!(dev, "Probe Rust Platform driver sample.\n"); if let Some(info) = info { - dev_info!(pdev.as_ref(), "Probed with info: '{}'.\n", info.0); + dev_info!(dev, "Probed with info: '{}'.\n", info.0); } - Self::properties_parse(pdev.as_ref())?; + Self::properties_parse(dev)?; let drvdata = KBox::new(Self { pdev: pdev.into() }, GFP_KERNEL)?;