Thread (23 messages) flat view 23 messages, 4 authors, 2026-03-04

Re: [PATCH v2 1/4] rust: io: Add big-endian read and write functions

From: "Danilo Krummrich" <dakr@kernel.org>
Date: 2026-02-04 15:20:27
Also in: lkml, rust-for-linux

On Wed Feb 4, 2026 at 4:18 PM CET, Danilo Krummrich wrote:
On Wed Feb 4, 2026 at 5:04 AM CET, Link Mauve wrote:
quoted
Another option would be to call u32::swap_bytes() on the data being
read/written, but these helpers make the Rust code as ergonomic as the C
code.

Signed-off-by: Link Mauve <redacted>
The I/O stuff recently changed quite significantly, please have a look at the
driver-core-next branch [1] in the driver-core tree.

Also, instead of providing additional *be() methods, we should just create a new
type io::Endianness and use it to indicate the device endianness when requesting
the I/O resource.

For instance, for your driver we could have

	request.iomap_exclusive_sized::<8>(Endianness::Big)?

and then let the I/O backend choose the correct accessors based on this.

I.e. the device is either big or little endian, hence we don't need to provide
both accessors at the same time.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core.git/log/?h=driver-core-next
Forgot to mention, please also consider this patch series [2] for your work.

[2] https://lore.kernel.org/all/20260202-io-v1-0-9bb2177d23be@nvidia.com/ (local)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help