[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2024121520-groove-outshine-f7f4@gregkh>
Date: Sun, 15 Dec 2024 13:23:22 +0100
From: Greg KH <gregkh@...uxfoundation.org>
To: Danilo Krummrich <dakr@...nel.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 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()?
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..."?
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...
thanks,
greg k-h
Powered by blists - more mailing lists