diff options
author | 2025-04-28 16:00:29 +0200 | |
---|---|---|
committer | 2025-05-04 17:54:08 +0200 | |
commit | b75a99e1077b12c5631fef7ac36970a89f6021f7 (patch) | |
tree | 48b3e5e8f09ac7654f4e63241ba60d7e09079c58 /samples | |
parent | rust: devres: implement Devres::access() (diff) | |
download | linux-rng-b75a99e1077b12c5631fef7ac36970a89f6021f7.tar.xz linux-rng-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 <acourbot@nvidia.com>
Acked-by: Boqun Feng <boqun.feng@gmail.com>
Reviewed-by: Joel Fernandes <joelagnelf@nvidia.com>
Link: https://lore.kernel.org/r/20250428140137.468709-4-dakr@kernel.org
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Diffstat (limited to 'samples')
-rw-r--r-- | samples/rust/rust_driver_pci.rs | 12 |
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()) } |