linux/rust/macros
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
..
io rust: io: perform conversions using AsRepr 2026-09-06 13:39:48 +02:00
concat_idents.rs rust: macros: convert concat_idents! to use syn 2026-01-28 00:55:25 +01:00
export.rs rust: macros: convert #[export] to use syn 2026-01-28 00:55:25 +01:00
fmt.rs Rust changes for v6.20 / v7.0 2026-02-10 11:53:01 -08:00
for_lt.rs rust: types: introduce ForLt base trait for CovariantForLt 2026-07-11 19:42:03 +02:00
helpers.rs rust: allow globally clippy::incompatible_msrv 2026-04-07 09:54:57 +02:00
kunit.rs rust: macros: simplify code using feature(extract_if) 2026-04-07 10:00:24 +02:00
lib.rs rust: io: register: reimplement as proc macro 2026-09-03 20:25:54 +02:00
module.rs Modules changes for 7.3-rc1 2026-08-21 12:47:25 -07:00
paste.rs rust: macros: use quote! from vendored crate 2026-01-28 00:55:24 +01:00
vtable.rs rust: macros: auto-insert OwnerModule in #[vtable] 2026-08-12 09:36:26 +02:00