[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20260117102701.3aecf2ce@inno-notebook>
Date: Sat, 17 Jan 2026 10:27:01 +0200
From: Zhi Wang <zhiw@...dia.com>
To: Danilo Krummrich <dakr@...nel.org>
CC: Gary Guo <gary@...yguo.net>, Alice Ryhl <aliceryhl@...gle.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>
Subject: Re: [PATCH v9 2/5] rust: io: factor common I/O helpers into Io
trait
On Fri, 16 Jan 2026 16:27:27 +0100
"Danilo Krummrich" <dakr@...nel.org> wrote:
> (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.
Agreed. The IoCapable<T> marker trait approach is much cleaner and
solves the hierarchy complexity Alice pointed out.
I'll pick this up for v10. Thanks!
Z.
Powered by blists - more mailing lists