[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DFQ4B7CJR5EW.TMEE2YAES7O2@kernel.org>
Date: Fri, 16 Jan 2026 16:27:27 +0100
From: "Danilo Krummrich" <dakr@...nel.org>
To: "Gary Guo" <gary@...yguo.net>
Cc: "Alice Ryhl" <aliceryhl@...gle.com>, "Zhi Wang" <zhiw@...dia.com>,
<rust-for-linux@...r.kernel.org>, <linux-pci@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <bhelgaas@...gle.com>,
<kwilczynski@...nel.org>, <ojeda@...nel.org>, <alex.gaynor@...il.com>,
<boqun.feng@...il.com>, <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>, <acourbot@...dia.com>, <joelagnelf@...dia.com>,
<jhubbard@...dia.com>, <zhiwang@...nel.org>,
<daniel.almeida@...labora.com>, <markus.probst@...teo.de>
Subject: Re: [PATCH v9 2/5] rust: io: factor common I/O helpers into Io
trait
(Cc: Markus)
On Fri Jan 16, 2026 at 4:23 PM CET, Gary Guo wrote:
> I wonder if we can keep all methods on `Io` trait. And then have marker trait to
> represent capability on performing Io access.
>
> Something like:
>
> trait IoCapable<T> {}
>
> trait Io {
> fn read8(&self, offset: usize) -> u8 where Self: IoCapable<u8>;
> fn read16(&self, offset: usize) -> u16 where Self: IoCapable<u16>;
> fn read32(&self, offset: usize) -> u32 where Self: IoCapable<u32>;
> fn read64(&self, offset: usize) -> u64 where Self: IoCapable<u64>;
> }
>
> Then you have a single (non-marker) trait and not a hierachy of them.
I think that is a great idea. I think it will also help with supporting I/O
backends based on regmap.
Powered by blists - more mailing lists