mirror of https://github.com/torvalds/linux.git
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>
This commit is contained in:
parent
f301cb978c
commit
b75a99e107
|
|
@ -83,12 +83,12 @@ fn probe(pdev: &pci::Device<Core>, info: &Self::IdInfo) -> Result<Pin<KBox<Self>
|
|||
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())
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue