aboutsummaryrefslogtreecommitdiffstats
path: root/samples/rust/rust_driver_pci.rs
diff options
context:
space:
mode:
authorDanilo Krummrich <[email protected]>2025-04-28 14:00:29 +0000
committerDanilo Krummrich <[email protected]>2025-05-04 15:54:08 +0000
commitb75a99e1077b12c5631fef7ac36970a89f6021f7 (patch)
tree48b3e5e8f09ac7654f4e63241ba60d7e09079c58 /samples/rust/rust_driver_pci.rs
parentrust: devres: implement Devres::access() (diff)
downloadkernel-b75a99e1077b12c5631fef7ac36970a89f6021f7.tar.gz
kernel-b75a99e1077b12c5631fef7ac36970a89f6021f7.zip
samples: rust: pci: take advantage of Devres::access()
For the I/O operations executed from the probe() method, take advantage of Devres::access(), avoiding the atomic check and RCU read lock required otherwise entirely. Reviewed-by: Alexandre Courbot <[email protected]> Acked-by: Boqun Feng <[email protected]> Reviewed-by: Joel Fernandes <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Danilo Krummrich <[email protected]>
Diffstat (limited to 'samples/rust/rust_driver_pci.rs')
-rw-r--r--samples/rust/rust_driver_pci.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/samples/rust/rust_driver_pci.rs b/samples/rust/rust_driver_pci.rs
index 9ce3a7323a16..15147e4401b2 100644
--- a/samples/rust/rust_driver_pci.rs
+++ b/samples/rust/rust_driver_pci.rs
@@ -83,12 +83,12 @@ impl pci::Driver for SampleDriver {
GFP_KERNEL,
)?;
- let res = drvdata
- .bar
- .try_access_with(|b| Self::testdev(info, b))
- .ok_or(ENXIO)??;
-
- dev_info!(pdev.as_ref(), "pci-testdev data-match count: {}\n", res);
+ let bar = drvdata.bar.access(pdev.as_ref())?;
+ dev_info!(
+ pdev.as_ref(),
+ "pci-testdev data-match count: {}\n",
+ Self::testdev(info, bar)?
+ );
Ok(drvdata.into())
}