mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 14:53:58 -04:00
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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
c5020c5be9
commit
354fd6e86f
@@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user