aboutsummaryrefslogtreecommitdiffstats
path: root/samples/rust/rust_driver_platform.rs
diff options
context:
space:
mode:
authorDanilo Krummrich <[email protected]>2025-06-20 15:18:49 +0000
committerDanilo Krummrich <[email protected]>2025-06-25 16:10:12 +0000
commitc69072d3a10976e48da97758a78c35305c24eeba (patch)
treec38f1d11ea8e6637f3ee9033a1bc16b26a5ebac4 /samples/rust/rust_driver_platform.rs
parentrust: device: implement FwNode::is_of_node() (diff)
downloadkernel-c69072d3a10976e48da97758a78c35305c24eeba.tar.gz
kernel-c69072d3a10976e48da97758a78c35305c24eeba.zip
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 <[email protected]> Reviewed-by: Dirk Behme <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Danilo Krummrich <[email protected]>
Diffstat (limited to 'samples/rust/rust_driver_platform.rs')
-rw-r--r--samples/rust/rust_driver_platform.rs8
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)?;