Re: [PATCH v5 20/20] rust: io: implement `IoSysMap`
"Alexandre Courbot" <[email protected]>
| Newsgroups | org.kernel.vger.linux-pwm,dev.linux.lists.driver-core,dev.linux.lists.nova-gpu,org.freedesktop.lists.dri-devel,org.kernel.vger.linux-kernel,org.kernel.vger.linux-pci,org.kernel.vger.rust-for-linux |
|---|---|
| Message-ID | <[email protected]> |
On Fri Jun 26, 2026 at 11:45 PM JST, Gary Guo wrote: > Add an enum as sum type for `Mmio` and `SysMem`. This serves similar > purpose of `iosys_map`. Thanks to Rust's type system, all of projection and > struct read/write can be handled by the generic I/O projection mechanism > (i.e. `io_project!`, `io_read!, `io_write!`) for free, and there is no need > to provide things like `iosys_map_rd_field` or `iosys_map_wr_field`. An > enum type also makes it very easy to construct or destruct. > > This could be made more generic by implementing on a general purpose sum > type like `Either`; however this is kept specific unless a need arises that > warrants this to be generic over other I/O backends. > > Signed-off-by: Gary Guo <[email protected]> Reviewed-by: Alexandre Courbot <[email protected]>