Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

+6 -6
+6 -6
samples/rust/rust_driver_pci.rs
··· 83 83 GFP_KERNEL, 84 84 )?; 85 85 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 + ); 92 92 93 93 Ok(drvdata.into()) 94 94 }