linux/rust/kernel/io
Gary Guo ff067ace5f rust: io: perform conversions using AsRepr
For types that are layout-compatible with an I/O capable type, we would
want the ability to use them directly for I/O operations. E.g.

    bitfield! {
        pub struct Foo(u32) {
            ...
        }
    }

    #[repr(C)]
    struct Bar {
        foo: Foo,
    }

    let mmio: Mmio<'_, Bar> = ...;
    io_read!(mmio, .foo)

Currently this feature is available from `register!()` macro but not
otherwise available with `io_read!`, `io_write!`. Support this by
performing conversions to I/O primitives via the `AsRepr`/`AsReprMut`
trait.

This makes the `IoLoc::IoType` and `Register::Storage` redundant; thus
remove them; also convert register methods to use the `read_val` and
`write_val` instead.

Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Gary Guo <gary@garyguo.net>
Tested-by: Alexandre Courbot <acourbot@nvidia.com>
Link: https://patch.msgid.link/20260901-typed_register-v4-4-5552b1d59525@garyguo.net
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
2026-09-06 13:39:48 +02:00
..
mem.rs I/O type generalization and projection 2026-07-13 23:50:39 +02:00
poll.rs rust: io: implement Mmio as view type 2026-07-11 17:59:32 +02:00
register.rs rust: io: perform conversions using AsRepr 2026-09-06 13:39:48 +02:00
resource.rs rust: make build_assert module the home of related macros 2026-06-10 09:07:13 +02:00