Re: [PATCH v2 03/16] rust: io: support register projections
"Gary Guo" <[email protected]>
| Newsgroups | 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 Mon Aug 10, 2026 at 10:30 AM BST, Alexandre Courbot wrote: > On Thu Aug 6, 2026 at 1:35 AM JST, Gary Guo wrote: >> `IoLoc`s themselves just describe a projection from a region to a concrete >> register. Thus, support it in `io_project` macro too. Also, update methods >> that operate on `IoLoc` to use I/O projection. >> >> Documentation of `io_project!` is not expanded yet as the example works >> better when `register!` type can specify base type. `io_read!` and >> `io_write!` gains the ability to operate on registers as corollary of the >> capability of `io_project!`. Examples are not added because `read` and >> `write` is still preferrably used instead. >> >> Signed-off-by: Gary Guo <[email protected]> >> --- >> rust/kernel/io.rs | 58 ++++++++++++++++++++++++++++++++++++++++++++----------- >> 1 file changed, 47 insertions(+), 11 deletions(-) >> >> [snip] >> >> + >> + #[inline(always)] >> + pub fn try_project_loc<U, L>( > > nit: missing documentation This is intentional as it's part of a `#[doc(hidden)]` type. The user-facing documentation is added in the subsequent commit as this cannot yet be used without specifying base type in `register!`. > >> + self, >> + location: L, >> + ) -> Result<<T::Backend as IoBackend>::View<'a, U>> >> + where >> + L: IoLoc<T::Target, U>, >> + { >> + io_view::<_, U>(self.0, location.offset()) >> + } >> + >> + #[inline(always)] >> + pub fn project_loc<U, L>(self, location: L) -> <T::Backend as IoBackend>::View<'a, U> > > ditto.