Skip to content

Commit b75a99e

Browse files
author
Danilo Krummrich
committed
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>
1 parent f301cb9 commit b75a99e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

samples/rust/rust_driver_pci.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,12 @@ impl pci::Driver for SampleDriver {
8383
GFP_KERNEL,
8484
)?;
8585

86-
let res = drvdata
87-
.bar
88-
.try_access_with(|b| Self::testdev(info, b))
89-
.ok_or(ENXIO)??;
90-
91-
dev_info!(pdev.as_ref(), "pci-testdev data-match count: {}\n", res);
86+
let bar = drvdata.bar.access(pdev.as_ref())?;
87+
dev_info!(
88+
pdev.as_ref(),
89+
"pci-testdev data-match count: {}\n",
90+
Self::testdev(info, bar)?
91+
);
9292

9393
Ok(drvdata.into())
9494
}

0 commit comments

Comments
 (0)