diff options
author | Fiona Behrens <me@kloenk.dev> | 2025-02-17 21:58:14 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-02-22 15:44:19 +0100 |
commit | 354fd6e86fac60b7c1ce2e6c83d4e6bf8af95f59 (patch) | |
tree | 8b15a77bbdbfc38c98b1c37f62d8545fa4e921d3 /samples/rust/rust_driver_pci.rs | |
parent | c5020c5be9d266f66fa5ba3286f0e8d2d2265970 (diff) | |
download | linux-354fd6e86fac60b7c1ce2e6c83d4e6bf8af95f59.tar.gz linux-354fd6e86fac60b7c1ce2e6c83d4e6bf8af95f59.tar.bz2 linux-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 <dakr@kernel.org>
Link: https://rust-for-linux.zulipchat.com/#narrow/channel/288089-General/topic/PIO.20support/near/499460541
Signed-off-by: Fiona Behrens <me@kloenk.dev>
Acked-by: Danilo Krummrich <dakr@kernel.org>
Acked-by: Daniel Almeida <daniel.almeida@collabora.com>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20250217-io-generic-rename-v1-1-06d97a9e3179@kloenk.dev
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'samples/rust/rust_driver_pci.rs')
-rw-r--r-- | samples/rust/rust_driver_pci.rs | 12 |
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)) } } |