mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-12-27 12:21:22 -05:00
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>
This commit is contained in:
@@ -36,13 +36,15 @@ fn probe(
|
||||
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)?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user