diff options
| author | Gary Guo <gary@garyguo.net> | 2026-09-01 17:50:28 +0100 |
|---|---|---|
| committer | Danilo Krummrich <dakr@kernel.org> | 2026-09-06 13:39:48 +0200 |
| commit | ff067ace5fbeada7e629d4aaccfa1d04da3eeebc (patch) | |
| tree | a40c85337e9f73cc915443381bbdfb0524de2d68 /scripts | |
| parent | ef605a433d80987e97fcf62a41bdf437abc61e2c (diff) | |
| download | linux-next-ff067ace5fbeada7e629d4aaccfa1d04da3eeebc.tar.gz linux-next-ff067ace5fbeada7e629d4aaccfa1d04da3eeebc.zip | |
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>
Diffstat (limited to 'scripts')
0 files changed, 0 insertions, 0 deletions
