[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260130171026.1138617-3-zijing.zhang@ry.rs>
Date: Fri, 30 Jan 2026 17:10:26 +0000
From: Zijing Zhang <zijing.zhang@...rs>
To: dakr@...nel.org,
ojeda@...nel.org
Cc: bhelgaas@...gle.com,
kwilczynski@...nel.org,
boqun.feng@...il.com,
gary@...yguo.net,
bjorn3_gh@...tonmail.com,
lossin@...nel.org,
a.hindborg@...nel.org,
aliceryhl@...gle.com,
tmgross@...ch.edu,
linux-pci@...r.kernel.org,
rust-for-linux@...r.kernel.org,
linux-kernel@...r.kernel.org,
lianux.mm@...il.com,
zijing.kernel@...il.com
Subject: [RFC PATCH 2/2] samples: rust: pci: exercise config space accessors
Use the new PCI config space accessors from the Rust PCI sample driver.
Signed-off-by: Zijing Zhang <zijing.zhang@...rs>
---
samples/rust/rust_driver_pci.rs | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/samples/rust/rust_driver_pci.rs b/samples/rust/rust_driver_pci.rs
index fa677991a5c4..1089352626fc 100644
--- a/samples/rust/rust_driver_pci.rs
+++ b/samples/rust/rust_driver_pci.rs
@@ -68,11 +68,15 @@ impl pci::Driver for SampleDriver {
fn probe(pdev: &pci::Device<Core>, info: &Self::IdInfo) -> impl PinInit<Self, Error> {
pin_init::pin_init_scope(move || {
let vendor = pdev.vendor_id();
+ let vendor_cfg = pdev.read_config_u16(0x00)?;
+ let device_cfg = pdev.read_config_u16(0x02)?;
dev_dbg!(
pdev.as_ref(),
- "Probe Rust PCI driver sample (PCI ID: {}, 0x{:x}).\n",
+ "Probe Rust PCI driver sample (PCI ID: {}, 0x{:x}; cfg: 0x{:04x}:0x{:04x}).\n",
vendor,
- pdev.device_id()
+ pdev.device_id(),
+ vendor_cfg,
+ device_cfg,
);
pdev.enable_device_mem()?;
--
2.52.0
Powered by blists - more mailing lists