aboutsummaryrefslogtreecommitdiffstats
path: root/samples/rust/rust_driver_pci.rs
diff options
context:
space:
mode:
authorFiona Behrens <[email protected]>2025-02-17 20:58:14 +0000
committerGreg Kroah-Hartman <[email protected]>2025-02-22 14:44:19 +0000
commit354fd6e86fac60b7c1ce2e6c83d4e6bf8af95f59 (patch)
tree8b15a77bbdbfc38c98b1c37f62d8545fa4e921d3 /samples/rust/rust_driver_pci.rs
parentkernfs: Move dput() outside of the RCU section. (diff)
downloadkernel-354fd6e86fac60b7c1ce2e6c83d4e6bf8af95f59.tar.gz
kernel-354fd6e86fac60b7c1ce2e6c83d4e6bf8af95f59.zip
rust: io: rename `io::Io` accessors
Rename the I/O accessors provided by `Io` to encode the type as number instead of letter. This is in preparation for Port I/O support to use a trait for generic accessors. Add a `c_fn` argument to the accessor generation macro to translate between rust and C names. Suggested-by: Danilo Krummrich <[email protected]> Link: https://rust-for-linux.zulipchat.com/#narrow/channel/288089-General/topic/PIO.20support/near/499460541 Signed-off-by: Fiona Behrens <[email protected]> Acked-by: Danilo Krummrich <[email protected]> Acked-by: Daniel Almeida <[email protected]> Reviewed-by: Greg Kroah-Hartman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
Diffstat (limited to 'samples/rust/rust_driver_pci.rs')
-rw-r--r--samples/rust/rust_driver_pci.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/samples/rust/rust_driver_pci.rs b/samples/rust/rust_driver_pci.rs
index 1fb6e44f3395..ddc52db71a82 100644
--- a/samples/rust/rust_driver_pci.rs
+++ b/samples/rust/rust_driver_pci.rs
@@ -43,17 +43,17 @@ kernel::pci_device_table!(
impl SampleDriver {
fn testdev(index: &TestIndex, bar: &Bar0) -> Result<u32> {
// Select the test.
- bar.writeb(index.0, Regs::TEST);
+ bar.write8(index.0, Regs::TEST);
- let offset = u32::from_le(bar.readl(Regs::OFFSET)) as usize;
- let data = bar.readb(Regs::DATA);
+ let offset = u32::from_le(bar.read32(Regs::OFFSET)) as usize;
+ let data = bar.read8(Regs::DATA);
// Write `data` to `offset` to increase `count` by one.
//
- // Note that we need `try_writeb`, since `offset` can't be checked at compile-time.
- bar.try_writeb(data, offset)?;
+ // Note that we need `try_write8`, since `offset` can't be checked at compile-time.
+ bar.try_write8(data, offset)?;
- Ok(bar.readl(Regs::COUNT))
+ Ok(bar.read32(Regs::COUNT))
}
}