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

"Loktionov, Aleksandr" <[email protected]>
Newsgroups org.kernel.vger.linux-parisc,dev.linux.lists.brcm80211,org.kernel.vger.linux-can,org.kernel.vger.linux-kernel,org.kernel.vger.linux-rdma,org.kernel.vger.linux-wireless,org.kernel.vger.netdev,org.osuosl.intel-wired-lan
Message-ID <IA3PR11MB89861D0A2ADD6A857708B0C9E5342@IA3PR11MB8986.namprd11.prod.outlook.com>

> -----Original Message-----
> From: Intel-wired-lan <[email protected]> On Behalf
> Of Uwe Kleine-König (The Capable Hub)
> Sent: Tuesday, April 28, 2026 7:19 PM
> To: Michael Grzeschik <[email protected]>; Andrew Lunn
> <[email protected]>; David S. Miller <[email protected]>; Eric
> Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo
> Abeni <[email protected]>; Marc Kleine-Budde <[email protected]>;
> Vincent Mailhol <[email protected]>; Krzysztof Halasa
> <[email protected]>; Johannes Berg <[email protected]>
> Cc: Richard Cochran <[email protected]>; Yonglong Liu
> <[email protected]>; Kees Cook <[email protected]>; linux-
> [email protected]; Zaremba, Larysa <[email protected]>;
> [email protected]; Daniele Venzano <[email protected]>; oss-
> [email protected]; Nguyen, Anthony L <[email protected]>;
> MD Danish Anwar <[email protected]>; Samuel Chessman
> <[email protected]>; Fan Gong <[email protected]>; Marco Crivellari
> <[email protected]>; Kevin Curtis
> <[email protected]>; Ingo Molnar <[email protected]>; Ion
> Badulescu <[email protected]>; Shevchenko, Andriy
> <[email protected]>; Leon Romanovsky <[email protected]>;
> Colin Ian King <[email protected]>; Kitszel, Przemyslaw
> <[email protected]>; Peiyang Wang
> <[email protected]>; Thomas Fourier <[email protected]>;
> Sai Krishna <[email protected]>; Denis Kirjanov
> <[email protected]>; [email protected]; linux-
> [email protected]; Keller, Jacob E <[email protected]>;
> Mengyuan Lou <[email protected]>; Steffen Klassert
> <[email protected]>; Stanislav Yakovlev <[email protected]>;
> [email protected]; Arend van Spriel
> <[email protected]>; [email protected]; Jiri Pirko
> <[email protected]>; Philipp Stanner <[email protected]>; Chi-hsien Lin
> <[email protected]>; Ido Schimmel <[email protected]>; Potnuri
> Bharat Teja <[email protected]>; Double Lo <[email protected]>;
> Markus Schneider-Pargmann <[email protected]>; Nathan Chancellor
> <[email protected]>; Jiawen Wu <[email protected]>; Cai Huoqing
> <[email protected]>; Bjorn Helgaas <[email protected]>; Zilin
> Guan <[email protected]>; [email protected]; Yibo Dong
> <[email protected]>; Joe Damato <[email protected]>; Petr Machata
> <[email protected]>; Kory Maincent <[email protected]>;
> [email protected]; [email protected];
> Vadim Fedorenko <[email protected]>; Manish Chopra
> <[email protected]>; Denis Benato <[email protected]>; Rasesh
> Mody <[email protected]>; [email protected]; Randy Dunlap
> <[email protected]>; Mark Bloch <[email protected]>; linux-
> [email protected]; Tariq Toukan <[email protected]>; Jian Shen
> <[email protected]>; Jijie Shao <[email protected]>; Yeounsu
> Moon <[email protected]>; Thomas Gleixner <[email protected]>; Simon
> Horman <[email protected]>; Yicong Hui <[email protected]>; Mark
> Einon <[email protected]>; Ethan Nelson-Moore
> <[email protected]>; Saeed Mahameed <[email protected]>;
> Sudarsana Kalluru <[email protected]>; Heiner Kallweit
> <[email protected]>
> 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-
> [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.
> 
> Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-
> [email protected]>
> ---
> 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 <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.