[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z2BUWSdxDU6S5mtr@pollux.localdomain>
Date: Mon, 16 Dec 2024 17:24:57 +0100
From: Danilo Krummrich <dakr@...nel.org>
To: Greg KH <gregkh@...uxfoundation.org>
Cc: rafael@...nel.org, bhelgaas@...gle.com, ojeda@...nel.org,
alex.gaynor@...il.com, boqun.feng@...il.com, gary@...yguo.net,
bjorn3_gh@...tonmail.com, benno.lossin@...ton.me, tmgross@...ch.edu,
a.hindborg@...sung.com, aliceryhl@...gle.com, airlied@...il.com,
fujita.tomonori@...il.com, lina@...hilina.net, pstanner@...hat.com,
ajanulgu@...hat.com, lyude@...hat.com, robh@...nel.org,
daniel.almeida@...labora.com, saravanak@...gle.com,
dirk.behme@...bosch.com, j@...nau.net, fabien.parent@...aro.org,
chrisi.schrefl@...il.com, paulmck@...nel.org,
rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-pci@...r.kernel.org, devicetree@...r.kernel.org,
rcu@...r.kernel.org
Subject: Re: [PATCH v6 09/16] rust: pci: add basic PCI device / driver
abstractions
On Sun, Dec 15, 2024 at 01:23:22PM +0100, Greg KH wrote:
> On Thu, Dec 12, 2024 at 05:33:40PM +0100, Danilo Krummrich wrote:
> > +impl DeviceId {
> > + const PCI_ANY_ID: u32 = !0;
> > +
> > + /// PCI_DEVICE macro.
> > + pub const fn new(vendor: u32, device: u32) -> Self {
> > + Self(bindings::pci_device_id {
> > + vendor,
> > + device,
> > + subvendor: DeviceId::PCI_ANY_ID,
> > + subdevice: DeviceId::PCI_ANY_ID,
> > + class: 0,
> > + class_mask: 0,
> > + driver_data: 0,
> > + override_only: 0,
> > + })
> > + }
> > +
> > + /// PCI_DEVICE_CLASS macro.
> > + pub const fn with_class(class: u32, class_mask: u32) -> Self {
>
> I know naming is hard, and I'm not going to object to this at all, but
> using "new()" and "with_class()" feels a bit odd and mis-matched. How
> about spelling it out, pci_device(), and pci_device_class()?
This is likely being call with module prefix, i.e. `pci::DeviceId::new`, so I'd
rather not encode "pci" again.
Maybe `pci::DeviceId::from_id` and `pci::DeviceId::from_class`?
>
> Anyway, not a bit deal at all, let's see how this plays out with real
> drivers and we can always change it later.
>
> > +// Allow drivers R/O access to the fields of `pci_device_id`; should we prefer accessor functions
> > +// to void exposing C structure fields?
>
> Minor nit, do you mean "to avoid exposing..."?
Yes, but I don't think we need this comment any longer, now that we do not pass
this to probe() any longer. I'll remove the `Deref` impl.
>
> Other than these, this looks good! If I can get an ack from the PCI
> maintainer, I'll be glad to queue these up in my driver core tree...
Sounds good!
>
> thanks,
>
> greg k-h
Powered by blists - more mailing lists