diff options
author | Danilo Krummrich <dakr@kernel.org> | 2025-06-20 16:18:49 +0100 |
---|---|---|
committer | Danilo Krummrich <dakr@kernel.org> | 2025-06-25 18:10:12 +0200 |
commit | c69072d3a10976e48da97758a78c35305c24eeba (patch) | |
tree | c38f1d11ea8e6637f3ee9033a1bc16b26a5ebac4 /samples/rust/rust_driver_platform.rs | |
parent | 56a789f776f24e6b132ec00d4c27672ed4e2ec57 (diff) |
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 <igor.korotin.linux@gmail.com>
Reviewed-by: Dirk Behme <dirk.behme@de.bosch.com>
Link: https://lore.kernel.org/r/20250620151849.281238-1-igor.korotin.linux@gmail.com
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Diffstat (limited to 'samples/rust/rust_driver_platform.rs')
-rw-r--r-- | samples/rust/rust_driver_platform.rs | 8 |
1 files changed, 5 insertions, 3 deletions
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<Core>, info: Option<&Self::IdInfo>, ) -> Result<Pin<KBox<Self>>> { - 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)?; |