Re: [PATCH v3 04/16] rust: io: perform conversions using `AsRepr`

[email protected]
Newsgroups org.kernel.vger.linux-pci,org.freedesktop.lists.dri-devel
Message-ID <[email protected]>
> 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.
> 
> Signed-off-by: Gary Guo <[email protected]>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.