RE: [Intel-wired-lan] [PATCH net-next] net: Consistently define pci_device_ids using named initializers

Loktionov, Aleksandr
2026-04-29T09:20:21Z

> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf
> Of Uwe Kleine-König (The Capable Hub)
> Sent: Tuesday, April 28, 2026 7:19 PM
> To: Michael Grzeschik <m.grzeschik@pengutronix.de>; Andrew Lunn
> <andrew+netdev@lunn.ch>; David S. Miller <davem@davemloft.net>; Eric
> Dumazet <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>; Paolo
> Abeni <pabeni@redhat.com>; Marc Kleine-Budde <mkl@pengutronix.de>;
> Vincent Mailhol <mailhol@kernel.org>; Krzysztof Halasa
> <khc@pm.waw.pl>; Johannes Berg <johannes@sipsolutions.net>
> Cc: Richard Cochran <richardcochran@gmail.com>; Yonglong Liu
> <liuyonglong@huawei.com>; Kees Cook <kees@kernel.org>; linux-
> wireless@vger.kernel.org; Zaremba, Larysa <larysa.zaremba@intel.com>;
> brcm80211@lists.linux.dev; Daniele Venzano <venza@brownhat.org>; oss-
> drivers@corigine.com; Nguyen, Anthony L <anthony.l.nguyen@intel.com>;
> MD Danish Anwar <danishanwar@ti.com>; Samuel Chessman
> <chessman@tux.org>; Fan Gong <gongfan1@huawei.com>; Marco Crivellari
> <marco.crivellari@suse.com>; Kevin Curtis
> <kevin.curtis@farsite.co.uk>; Ingo Molnar <mingo@kernel.org>; Ion
> Badulescu <ionut@badula.org>; Shevchenko, Andriy
> <andriy.shevchenko@intel.com>; Leon Romanovsky <leon@kernel.org>;
> Colin Ian King <colin.i.king@gmail.com>; Kitszel, Przemyslaw
> <przemyslaw.kitszel@intel.com>; Peiyang Wang
> <wangpeiyang1@huawei.com>; Thomas Fourier <fourier.thomas@gmail.com>;
> Sai Krishna <saikrishnag@marvell.com>; Denis Kirjanov
> <kirjanov@gmail.com>; intel-wired-lan@lists.osuosl.org; linux-
> parisc@vger.kernel.org; Keller, Jacob E <jacob.e.keller@intel.com>;
> Mengyuan Lou <mengyuanlou@net-swift.com>; Steffen Klassert
> <klassert@kernel.org>; Stanislav Yakovlev <stas.yakovlev@gmail.com>;
> linux-rdma@vger.kernel.org; Arend van Spriel
> <arend.vanspriel@broadcom.com>; nic_swsd@realtek.com; Jiri Pirko
> <jiri@resnulli.us>; Philipp Stanner <phasta@kernel.org>; Chi-hsien Lin
> <chi-hsien.lin@cypress.com>; Ido Schimmel <idosch@nvidia.com>; Potnuri
> Bharat Teja <bharat@chelsio.com>; Double Lo <double.lo@cypress.com>;
> Markus Schneider-Pargmann <msp@baylibre.com>; Nathan Chancellor
> <nathan@kernel.org>; Jiawen Wu <jiawenwu@trustnetic.com>; Cai Huoqing
> <cai.huoqing@linux.dev>; Bjorn Helgaas <bhelgaas@google.com>; Zilin
> Guan <zilin@seu.edu.cn>; linux-can@vger.kernel.org; Yibo Dong
> <dong100@mucse.com>; Joe Damato <joe@dama.to>; Petr Machata
> <petrm@nvidia.com>; Kory Maincent <kory.maincent@bootlin.com>;
> brcm80211-dev-list.pdl@broadcom.com; GR-Linux-NIC-Dev@marvell.com;
> Vadim Fedorenko <vadim.fedorenko@linux.dev>; Manish Chopra
> <manishc@marvell.com>; Denis Benato <benato.denis96@gmail.com>; Rasesh
> Mody <rmody@marvell.com>; netdev@vger.kernel.org; Randy Dunlap
> <rdunlap@infradead.org>; Mark Bloch <mbloch@nvidia.com>; linux-
> kernel@vger.kernel.org; Tariq Toukan <tariqt@nvidia.com>; Jian Shen
> <shenjian15@huawei.com>; Jijie Shao <shaojijie@huawei.com>; Yeounsu
> Moon <yyyynoom@gmail.com>; Thomas Gleixner <tglx@kernel.org>; Simon
> Horman <horms@kernel.org>; Yicong Hui <yiconghui@gmail.com>; Mark
> Einon <mark.einon@gmail.com>; Ethan Nelson-Moore
> <enelsonmoore@gmail.com>; Saeed Mahameed <saeedm@nvidia.com>;
> Sudarsana Kalluru <skalluru@marvell.com>; Heiner Kallweit
> <hkallweit1@gmail.com>
> Subject: [Intel-wired-lan] [PATCH net-next] net: Consistently define
> pci_device_ids using named initializers
>
> ... 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/cover.1776579304.git.u.kleine-
> koenig@baylibre.com/)
> 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.
>
> Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-
> koenig@baylibre.com>
> ---
> Hello,
>
> the mentioned follow-up quest allows to do
>
> PCI_DEVICE(0x1571, 0xa203),
> + .driver_data = (kernel_ulong_t)&card_info_10mbit,
> - .driver_data_ptr = &card_info_10mbit,
>
> which gets rid of a bunch of casts and so brings a little bit more
> type
> safety. This patch is a preparation for that.
>
> I handled all of drivers/net/ in a single patch, please tell me if I
> should split by subsystem.
>
> Best regards
> Uwe
> ---
> drivers/net/arcnet/com20020-pci.c | 242 +++------
> drivers/net/can/m_can/m_can_pci.c | 6 +-
> drivers/net/can/sja1000/plx_pci.c | 167 +++----
> drivers/net/ethernet/3com/3c59x.c | 80 +--
> drivers/net/ethernet/3com/typhoon.c | 75 ++-
> drivers/net/ethernet/8390/ne2k-pci.c | 24 +-
> drivers/net/ethernet/adaptec/starfire.c | 4 +-
> drivers/net/ethernet/agere/et131x.c | 6 +-
> drivers/net/ethernet/broadcom/bnx2.c | 62 ++-
> .../net/ethernet/broadcom/bnx2x/bnx2x_main.c | 50 +-
> .../net/ethernet/cavium/liquidio/lio_main.c | 10 +-
> .../ethernet/cavium/liquidio/lio_vf_main.c | 7 +-
> drivers/net/ethernet/chelsio/cxgb/common.h | 2 +-
> drivers/net/ethernet/chelsio/cxgb/subr.c | 2 +-
> .../net/ethernet/chelsio/cxgb3/cxgb3_main.c | 4 +-
> .../net/ethernet/chelsio/cxgb4/cxgb4_main.c | 4 +-
> .../ethernet/chelsio/cxgb4vf/cxgb4vf_main.c | 4 +-
> drivers/net/ethernet/dec/tulip/de2104x.c | 6 +-
> drivers/net/ethernet/dec/tulip/dmfe.c | 12 +-
> drivers/net/ethernet/dec/tulip/tulip_core.c | 78 +--
> drivers/net/ethernet/dec/tulip/uli526x.c | 6 +-
> drivers/net/ethernet/dec/tulip/winbond-840.c | 13 +-
> drivers/net/ethernet/dlink/dl2k.h | 12 +-
> drivers/net/ethernet/dlink/sundance.c | 14 +-
> drivers/net/ethernet/fealnx.c | 8 +-
> .../net/ethernet/hisilicon/hibmcge/hbg_main.c | 2 +-
> .../net/ethernet/hisilicon/hns3/hns3_enet.c | 50 +-
> .../hisilicon/hns3/hns3pf/hclge_main.c | 18 +-
> .../hisilicon/hns3/hns3vf/hclgevf_main.c | 12 +-
> .../net/ethernet/huawei/hinic/hinic_main.c | 12 +-
> .../net/ethernet/huawei/hinic3/hinic3_lld.c | 7 +-
> drivers/net/ethernet/intel/e100.c | 4 +-
> drivers/net/ethernet/intel/e1000e/netdev.c | 471 +++++++++++++----
> -
> drivers/net/ethernet/intel/fm10k/fm10k_pci.c | 10 +-
> drivers/net/ethernet/intel/i40e/i40e_main.c | 59 +--
> drivers/net/ethernet/intel/iavf/iavf_main.c | 10 +-
> drivers/net/ethernet/intel/igb/igb_main.c | 66 +--
> drivers/net/ethernet/intel/igbvf/netdev.c | 4 +-
> drivers/net/ethernet/intel/igc/igc_main.c | 34 +-
> drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 106 ++--
> .../net/ethernet/intel/ixgbevf/ixgbevf_main.c | 49 +-
> drivers/net/ethernet/mellanox/mlx4/main.c | 6 +-
> .../net/ethernet/mellanox/mlx5/core/main.c | 26 +-
> .../net/ethernet/mellanox/mlxsw/spectrum.c | 16 +-
> drivers/net/ethernet/micrel/ksz884x.c | 8 +-
> .../net/ethernet/mucse/rnpgbe/rnpgbe_main.c | 10 +-
> drivers/net/ethernet/natsemi/natsemi.c | 4 +-
> drivers/net/ethernet/netronome/nfp/nfp_main.c | 81 +--
> .../ethernet/netronome/nfp/nfp_netvf_main.c | 41 +-
> drivers/net/ethernet/qlogic/qede/qede_main.c | 20 +-
> drivers/net/ethernet/realtek/8139too.c | 52 +-
> drivers/net/ethernet/realtek/r8169_main.c | 8 +-
> drivers/net/ethernet/rocker/rocker_main.c | 4 +-
> drivers/net/ethernet/sis/sis190.c | 6 +-
> drivers/net/ethernet/sis/sis900.c | 10 +-
> drivers/net/ethernet/smsc/epic100.c | 18 +-
> drivers/net/ethernet/sun/cassini.c | 8 +-
> drivers/net/ethernet/sun/sungem.c | 26 +-
> drivers/net/ethernet/ti/tlan.c | 41 +-
> drivers/net/ethernet/wangxun/ngbe/ngbe_main.c | 26 +-
> .../net/ethernet/wangxun/ngbevf/ngbevf_main.c | 26 +-
> .../net/ethernet/wangxun/txgbe/txgbe_main.c | 18 +-
> .../ethernet/wangxun/txgbevf/txgbevf_main.c | 18 +-
> drivers/net/wan/farsync.c | 24 +-
> drivers/net/wan/pc300too.c | 14 +-
> drivers/net/wan/pci200syn.c | 6 +-
> drivers/net/wan/wanxl.c | 11 +-
> .../broadcom/brcm80211/brcmfmac/pcie.c | 17 +-
> drivers/net/wireless/intel/ipw2x00/ipw2200.c | 52 +-
> 69 files changed, 1308 insertions(+), 1101 deletions(-)
>
> 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[] = {
> {

...

> };
>
> MODULE_DEVICE_TABLE(pci, card_ids);
>
> base-commit: 254f49634ee16a731174d2ae34bc50bd5f45e731
> --
> 2.47.3

Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>