Re: [PATCH v3 3/5] rust: pci: make Vendor::from_raw() public
From: John Hubbard
Date: Thu Sep 24 2026 - 15:04:58 EST
On 8/25/26 5:32 AM, Alice Ryhl wrote:
On Wed, Aug 12, 2026 at 09:52:37PM +0200, Maurice Hieronymus wrote:I strongly agree. There is no need to break the nice type system here,
`Vendor::from_raw()` is currently `pub(super)`, so a Vendor can only be
obtained through the named constants generated from the
`PCI_VENDOR_ID_*` defines in `<linux/pci_ids.h>`. A driver therefore
cannot match a device whose vendor ID has no symbolic name.
Such devices exist. QEMU's "edu" educational device and the legacy
qemu/Bochs stdvga both use vendor ID 0x1234, which is not registered in
`pci_ids.h`. Per the policy stated at the top of that header, IDs are
only added there when shared between multiple drivers; a single-driver
ID is expected to be open-coded in the driver instead. C drivers already
do this -- see `drivers/gpu/drm/tiny/bochs.c`, which matches with a bare
".vendor = 0x1234".
IMO we should just add Qemu to the list. No reason to hard-code it per
driver for this case.
just to avoid adding an "edu 0x1234" entry.
thanks,
--
John Hubbard