Re: [PATCH net-next v3 2/2] net: Consistently define pci_device_ids using named initializers
Michael Grzeschik <[email protected]> Mon, 11 May 2026 13:57:49 +0200
| Newsgroups | dev.linux.lists.brcm80211,org.kernel.vger.linux-can,org.kernel.vger.linux-kernel,org.kernel.vger.linux-parisc,org.kernel.vger.linux-rdma,org.kernel.vger.linux-wireless,org.kernel.vger.netdev,org.osuosl.intel-wired-lan |
|---|---|
| Message-ID | <[email protected]> |
On Mon, May 11, 2026 at 11:00:24AM +0200, Uwe Kleine-König (The Capable Hub) wrote: > ... and PCI device helpers. > > The various struct pci_device_id arrays were initialized mostly by one > the PCI_DEVICE macros and then list expressions. The latter isn't easily > readable if you're not into PCI. Using named initializers is more > explicit and thus easier to parse. > > Also use PCI_DEVICE* helper macros to assign .vendor, .device, > .subvendor and .subdevice where appropriate and skip explicit > assignments of 0 (which the compiler takes care of). > > The secret plan is to make struct pci_device_id::driver_data an > anonymous union (similar to > https://lore.kernel.org/all/[email protected]/) > and that requires named initializers. But it's also a nice cleanup on > its own. > > This change doesn't introduce changes to the compiled pci_device_id > arrays. Tested on x86 and arm64. > > Reviewed-by: Jijie Shao <[email protected]> > Acked-by: Arend van Spriel <[email protected]> > Reviewed-by: Aleksandr Loktionov <[email protected]> > Reviewed-by: Petr Machata <[email protected]> # for mlxsw > Acked-by: Jacob Keller <[email protected]> > Acked-by: Johannes Berg <[email protected]> > Signed-off-by: Uwe Kleine-König (The Capable Hub) <[email protected]> > Forwarded: id:76da4f44d48bdde84580963862bf9616bee5c9e9.1778149923.git.u.kleine-koenig@baylibre.com (v2) > --- > drivers/net/arcnet/com20020-pci.c | 242 +++------ [...] > diff --git a/drivers/net/arcnet/com20020-pci.c b/drivers/net/arcnet/com20020-pci.c > index dbadda08dce2..6474c7be2992 100644 > --- a/drivers/net/arcnet/com20020-pci.c > +++ b/drivers/net/arcnet/com20020-pci.c > @@ -459,168 +459,88 @@ static struct com20020_pci_card_info card_info_eae_fb2 = { > > static const struct pci_device_id com20020pci_id_table[] = { > { > - 0x1571, 0xa001, > - PCI_ANY_ID, PCI_ANY_ID, > - 0, 0, > - 0, > + PCI_DEVICE(0x1571, 0xa001), > + .driver_data = 0, > + }, { > + PCI_DEVICE(0x1571, 0xa002), > + .driver_data = 0, > + }, { > + PCI_DEVICE(0x1571, 0xa003), > + .driver_data = 0, > + }, { > + PCI_DEVICE(0x1571, 0xa004), > + .driver_data = 0, > + }, { > + PCI_DEVICE(0x1571, 0xa005), > + .driver_data = 0, > + }, { > + PCI_DEVICE(0x1571, 0xa006), > + .driver_data = 0, > + }, { > + PCI_DEVICE(0x1571, 0xa007), > + .driver_data = 0, > + }, { > + PCI_DEVICE(0x1571, 0xa008), > + .driver_data = 0, > + }, { > + PCI_DEVICE(0x1571, 0xa009), > + .driver_data = (kernel_ulong_t)&card_info_5mbit, > + }, { > + PCI_DEVICE(0x1571, 0xa00a), > + .driver_data = (kernel_ulong_t)&card_info_5mbit, > + }, { > + PCI_DEVICE(0x1571, 0xa00b), > + .driver_data = (kernel_ulong_t)&card_info_5mbit, > + }, { > + PCI_DEVICE(0x1571, 0xa00c), > + .driver_data = (kernel_ulong_t)&card_info_5mbit, > + }, { > + PCI_DEVICE(0x1571, 0xa00d), > + .driver_data = (kernel_ulong_t)&card_info_5mbit, > + }, { > + PCI_DEVICE(0x1571, 0xa00e), > + .driver_data = (kernel_ulong_t)&card_info_5mbit, > + }, { > + PCI_DEVICE(0x1571, 0xa201), > + .driver_data = (kernel_ulong_t)&card_info_10mbit, > + }, { > + PCI_DEVICE(0x1571, 0xa202), > + .driver_data = (kernel_ulong_t)&card_info_10mbit, > + }, { > + PCI_DEVICE(0x1571, 0xa203), > + .driver_data = (kernel_ulong_t)&card_info_10mbit, > + }, { > + PCI_DEVICE(0x1571, 0xa204), > + .driver_data = (kernel_ulong_t)&card_info_10mbit, > + }, { > + PCI_DEVICE(0x1571, 0xa205), > + .driver_data = (kernel_ulong_t)&card_info_10mbit, > + }, { > + PCI_DEVICE(0x1571, 0xa206), > + .driver_data = (kernel_ulong_t)&card_info_10mbit, > + }, { > + PCI_DEVICE_SUB(0x10B5, 0x9030, 0x10B5, 0x2978), > + .driver_data = (kernel_ulong_t)&card_info_sohard, > + }, { > + PCI_DEVICE_SUB(0x10B5, 0x9050, 0x10B5, 0x2273), > + .driver_data = (kernel_ulong_t)&card_info_sohard, > + }, { > + PCI_DEVICE_SUB(0x10B5, 0x9050, 0x10B5, 0x3263), > + .driver_data = (kernel_ulong_t)&card_info_eae_arc1, > + }, { > + PCI_DEVICE_SUB(0x10B5, 0x9050, 0x10B5, 0x3292), > + .driver_data = (kernel_ulong_t)&card_info_eae_ma1, > + }, { > + PCI_DEVICE_SUB(0x10B5, 0x9050, 0x10B5, 0x3294), > + .driver_data = (kernel_ulong_t)&card_info_eae_fb2, > + }, { > + PCI_DEVICE(0x14BA, 0x6000), > + .driver_data = (kernel_ulong_t)&card_info_10mbit, > + }, { > + PCI_DEVICE(0x10B5, 0x2200), > + .driver_data = (kernel_ulong_t)&card_info_10mbit, > }, > - { > - 0x1571, 0xa002, > - PCI_ANY_ID, PCI_ANY_ID, > - 0, 0, > - 0, > - }, > - { > - 0x1571, 0xa003, > - PCI_ANY_ID, PCI_ANY_ID, > - 0, 0, > - 0 > - }, > - { > - 0x1571, 0xa004, > - PCI_ANY_ID, PCI_ANY_ID, > - 0, 0, > - 0, > - }, > - { > - 0x1571, 0xa005, > - PCI_ANY_ID, PCI_ANY_ID, > - 0, 0, > - 0 > - }, > - { > - 0x1571, 0xa006, > - PCI_ANY_ID, PCI_ANY_ID, > - 0, 0, > - 0 > - }, > - { > - 0x1571, 0xa007, > - PCI_ANY_ID, PCI_ANY_ID, > - 0, 0, > - 0 > - }, > - { > - 0x1571, 0xa008, > - PCI_ANY_ID, PCI_ANY_ID, > - 0, 0, > - 0 > - }, > - { > - 0x1571, 0xa009, > - PCI_ANY_ID, PCI_ANY_ID, > - 0, 0, > - (kernel_ulong_t)&card_info_5mbit > - }, > - { > - 0x1571, 0xa00a, > - PCI_ANY_ID, PCI_ANY_ID, > - 0, 0, > - (kernel_ulong_t)&card_info_5mbit > - }, > - { > - 0x1571, 0xa00b, > - PCI_ANY_ID, PCI_ANY_ID, > - 0, 0, > - (kernel_ulong_t)&card_info_5mbit > - }, > - { > - 0x1571, 0xa00c, > - PCI_ANY_ID, PCI_ANY_ID, > - 0, 0, > - (kernel_ulong_t)&card_info_5mbit > - }, > - { > - 0x1571, 0xa00d, > - PCI_ANY_ID, PCI_ANY_ID, > - 0, 0, > - (kernel_ulong_t)&card_info_5mbit > - }, > - { > - 0x1571, 0xa00e, > - PCI_ANY_ID, PCI_ANY_ID, > - 0, 0, > - (kernel_ulong_t)&card_info_5mbit > - }, > - { > - 0x1571, 0xa201, > - PCI_ANY_ID, PCI_ANY_ID, > - 0, 0, > - (kernel_ulong_t)&card_info_10mbit > - }, > - { > - 0x1571, 0xa202, > - PCI_ANY_ID, PCI_ANY_ID, > - 0, 0, > - (kernel_ulong_t)&card_info_10mbit > - }, > - { > - 0x1571, 0xa203, > - PCI_ANY_ID, PCI_ANY_ID, > - 0, 0, > - (kernel_ulong_t)&card_info_10mbit > - }, > - { > - 0x1571, 0xa204, > - PCI_ANY_ID, PCI_ANY_ID, > - 0, 0, > - (kernel_ulong_t)&card_info_10mbit > - }, > - { > - 0x1571, 0xa205, > - PCI_ANY_ID, PCI_ANY_ID, > - 0, 0, > - (kernel_ulong_t)&card_info_10mbit > - }, > - { > - 0x1571, 0xa206, > - PCI_ANY_ID, PCI_ANY_ID, > - 0, 0, > - (kernel_ulong_t)&card_info_10mbit > - }, > - { > - 0x10B5, 0x9030, > - 0x10B5, 0x2978, > - 0, 0, > - (kernel_ulong_t)&card_info_sohard > - }, > - { > - 0x10B5, 0x9050, > - 0x10B5, 0x2273, > - 0, 0, > - (kernel_ulong_t)&card_info_sohard > - }, > - { > - 0x10B5, 0x9050, > - 0x10B5, 0x3263, > - 0, 0, > - (kernel_ulong_t)&card_info_eae_arc1 > - }, > - { > - 0x10B5, 0x9050, > - 0x10B5, 0x3292, > - 0, 0, > - (kernel_ulong_t)&card_info_eae_ma1 > - }, > - { > - 0x10B5, 0x9050, > - 0x10B5, 0x3294, > - 0, 0, > - (kernel_ulong_t)&card_info_eae_fb2 > - }, > - { > - 0x14BA, 0x6000, > - PCI_ANY_ID, PCI_ANY_ID, > - 0, 0, > - (kernel_ulong_t)&card_info_10mbit > - }, > - { > - 0x10B5, 0x2200, > - PCI_ANY_ID, PCI_ANY_ID, > - 0, 0, > - (kernel_ulong_t)&card_info_10mbit > - }, > - { 0, } > + { } > }; > > MODULE_DEVICE_TABLE(pci, com20020pci_id_table); For the com20020 arcnet driver: Reviewed-by: Michael Grzeschik <[email protected]>