[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DFV3JJLHQORR.1RZOH2H5Z3F2B@garyguo.net>
Date: Thu, 22 Jan 2026 11:54:40 +0000
From: "Gary Guo" <gary@...yguo.net>
To: "Alexandre Courbot" <acourbot@...dia.com>, "Zhi Wang" <zhiw@...dia.com>
Cc: <rust-for-linux@...r.kernel.org>, <linux-pci@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <dakr@...nel.org>, <aliceryhl@...gle.com>,
<bhelgaas@...gle.com>, <kwilczynski@...nel.org>, <ojeda@...nel.org>,
<alex.gaynor@...il.com>, <boqun.feng@...il.com>, <gary@...yguo.net>,
<bjorn3_gh@...tonmail.com>, <lossin@...nel.org>, <a.hindborg@...nel.org>,
<tmgross@...ch.edu>, <markus.probst@...teo.de>, <helgaas@...nel.org>,
<cjia@...dia.com>, <smitra@...dia.com>, <ankita@...dia.com>,
<aniketa@...dia.com>, <kwankhede@...dia.com>, <targupta@...dia.com>,
<joelagnelf@...dia.com>, <jhubbard@...dia.com>, <zhiwang@...nel.org>,
<daniel.almeida@...labora.com>
Subject: Re: [PATCH v12 3/5] rust: io: factor out MMIO read/write macros
On Thu Jan 22, 2026 at 4:30 AM GMT, Alexandre Courbot wrote:
> On Thu Jan 22, 2026 at 5:22 AM JST, Zhi Wang wrote:
>> Refactor the existing MMIO accessors to use common call macros
>> instead of inlining the bindings calls in each `define_{read,write}!`
>> expansion.
>>
>> This factoring separates the common offset/bounds checks from the
>> low-level call pattern, making it easier to add additional I/O accessor
>> families.
>>
>> No functional change intended.
>>
>> Cc: Alexandre Courbot <acourbot@...dia.com>
>> Signed-off-by: Zhi Wang <zhiw@...dia.com>
>
> I still want to eventually switch to a trait hierarchy that removes the
> need for these intricate macros, but that's a few more step ahead. For
> now this integrates well with the current design.
I am not sure a actual hierarchy is needed, but the suggestion you have to add
`unchecked` method and have the bound checking be part of `Io` should remove the
need of an fallible and infallible variants.
I think we still need macros to actually dispatch the read/write functions
anyway as they're different for each access size.
Best,
Gary
Powered by blists - more mailing lists