Netdev List
 help / color / mirror / Atom feed
From: Michael Grzeschik <mgr@kernel.org>
To: "Uwe Kleine-König (The Capable Hub)" <u.kleine-koenig@baylibre.com>
Cc: 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>,
	Johannes Berg <johannes@sipsolutions.net>,
	Steffen Klassert <klassert@kernel.org>,
	David Dillow <dave@thedillows.org>,
	Ion Badulescu <ionut@badula.org>,
	Mark Einon <mark.einon@gmail.com>,
	Rasesh Mody <rmody@marvell.com>,
	GR-Linux-NIC-Dev@marvell.com, Manish Chopra <manishc@marvell.com>,
	Potnuri Bharat Teja <bharat@chelsio.com>,
	Denis Kirjanov <kirjanov@gmail.com>,
	Jijie Shao <shaojijie@huawei.com>,
	Jian Shen <shenjian15@huawei.com>,
	Cai Huoqing <cai.huoqing@linux.dev>,
	Fan Gong <gongfan1@huawei.com>,
	Tony Nguyen <anthony.l.nguyen@intel.com>,
	Przemek Kitszel <przemyslaw.kitszel@intel.com>,
	Tariq Toukan <tariqt@nvidia.com>,
	Saeed Mahameed <saeedm@nvidia.com>,
	Leon Romanovsky <leon@kernel.org>, Mark Bloch <mbloch@nvidia.com>,
	Ido Schimmel <idosch@nvidia.com>, Petr Machata <petrm@nvidia.com>,
	Yibo Dong <dong100@mucse.com>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	nic_swsd@realtek.com, Jiri Pirko <jiri@resnulli.us>,
	Francois Romieu <romieu@fr.zoreil.com>,
	Daniele Venzano <venza@brownhat.org>,
	Samuel Chessman <chessman@tux.org>,
	Jiawen Wu <jiawenwu@trustnetic.com>,
	Mengyuan Lou <mengyuanlou@net-swift.com>,
	Kevin Curtis <kevin.curtis@farsite.co.uk>,
	Arend van Spriel <arend.vanspriel@broadcom.com>,
	Stanislav Yakovlev <stas.yakovlev@gmail.com>,
	Richard Cochran <richardcochran@gmail.com>,
	Kees Cook <kees@kernel.org>,
	Aleksandr Loktionov <aleksandr.loktionov@intel.com>,
	Thomas Gleixner <tglx@kernel.org>,
	Jacob Keller <jacob.e.keller@intel.com>,
	Thomas Fourier <fourier.thomas@gmail.com>,
	Ingo Molnar <mingo@kernel.org>,
	Kory Maincent <kory.maincent@bootlin.com>,
	Zilin Guan <zilin@seu.edu.cn>,
	Vadim Fedorenko <vadim.fedorenko@linux.dev>,
	Marco Crivellari <marco.crivellari@suse.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	David Arinzon <darinzon@amazon.com>,
	Yeounsu Moon <yyyynoom@gmail.com>,
	Denis Benato <benato.denis96@gmail.com>,
	Yonglong Liu <liuyonglong@huawei.com>,
	Andy Shevchenko <andriy.shevchenko@intel.com>,
	Randy Dunlap <rdunlap@infradead.org>,
	Yicong Hui <yiconghui@gmail.com>,
	MD Danish Anwar <danishanwar@ti.com>,
	Nathan Chancellor <nathan@kernel.org>,
	Ethan Nelson-Moore <enelsonmoore@gmail.com>,
	Larysa Zaremba <larysa.zaremba@intel.com>,
	Ian Lin <ian.lin@infineon.com>,
	Colin Ian King <colin.i.king@gmail.com>,
	Double Lo <double.lo@cypress.com>,
	Markus Schneider-Pargmann <msp@baylibre.com>,
	Simon Horman <horms@kernel.org>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-can@vger.kernel.org, linux-parisc@vger.kernel.org,
	intel-wired-lan@lists.osuosl.org, linux-rdma@vger.kernel.org,
	oss-drivers@corigine.com, linux-wireless@vger.kernel.org,
	brcm80211@lists.linux.dev, brcm80211-dev-list.pdl@broadcom.com
Subject: Re: [PATCH net-next v3 2/2] net: Consistently define pci_device_ids using named initializers
Date: Mon, 11 May 2026 13:57:49 +0200	[thread overview]
Message-ID: <agHEPQ5tLFKW0uum@pengutronix.de> (raw)
In-Reply-To: <20260511090023.1634387-6-u.kleine-koenig@baylibre.com>

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/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.
> 
> Reviewed-by: Jijie Shao <shaojijie@huawei.com>
> Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
> Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
> Reviewed-by: Petr Machata <petrm@nvidia.com> # for mlxsw
> Acked-by: Jacob Keller <jacob.e.keller@intel.com>
> Acked-by: Johannes Berg <johannes@sipsolutions.net>
> Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
> 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 <mgr@kernel.org>

      parent reply	other threads:[~2026-05-11 11:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-11  9:00 [PATCH net-next v3 0/2] Rework pci_device_id initialisation Uwe Kleine-König (The Capable Hub)
2026-05-11  9:00 ` [PATCH net-next v3 1/2] net: nfp: Drop PCI class entries with .class_mask = 0 Uwe Kleine-König (The Capable Hub)
2026-05-11  9:06   ` Loktionov, Aleksandr
2026-05-11  9:00 ` [PATCH net-next v3 2/2] net: Consistently define pci_device_ids using named initializers Uwe Kleine-König (The Capable Hub)
2026-05-11  9:21   ` Uwe Kleine-König (The Capable Hub)
2026-05-11 11:57   ` Michael Grzeschik [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=agHEPQ5tLFKW0uum@pengutronix.de \
    --to=mgr@kernel.org \
    --cc=GR-Linux-NIC-Dev@marvell.com \
    --cc=aleksandr.loktionov@intel.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=andriy.shevchenko@intel.com \
    --cc=anthony.l.nguyen@intel.com \
    --cc=arend.vanspriel@broadcom.com \
    --cc=benato.denis96@gmail.com \
    --cc=bharat@chelsio.com \
    --cc=bhelgaas@google.com \
    --cc=brcm80211-dev-list.pdl@broadcom.com \
    --cc=brcm80211@lists.linux.dev \
    --cc=cai.huoqing@linux.dev \
    --cc=chessman@tux.org \
    --cc=colin.i.king@gmail.com \
    --cc=danishanwar@ti.com \
    --cc=darinzon@amazon.com \
    --cc=dave@thedillows.org \
    --cc=davem@davemloft.net \
    --cc=dong100@mucse.com \
    --cc=double.lo@cypress.com \
    --cc=edumazet@google.com \
    --cc=enelsonmoore@gmail.com \
    --cc=fourier.thomas@gmail.com \
    --cc=gongfan1@huawei.com \
    --cc=hkallweit1@gmail.com \
    --cc=horms@kernel.org \
    --cc=ian.lin@infineon.com \
    --cc=idosch@nvidia.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=ionut@badula.org \
    --cc=jacob.e.keller@intel.com \
    --cc=jiawenwu@trustnetic.com \
    --cc=jiri@resnulli.us \
    --cc=johannes@sipsolutions.net \
    --cc=kees@kernel.org \
    --cc=kevin.curtis@farsite.co.uk \
    --cc=kirjanov@gmail.com \
    --cc=klassert@kernel.org \
    --cc=kory.maincent@bootlin.com \
    --cc=kuba@kernel.org \
    --cc=larysa.zaremba@intel.com \
    --cc=leon@kernel.org \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-parisc@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=liuyonglong@huawei.com \
    --cc=mailhol@kernel.org \
    --cc=manishc@marvell.com \
    --cc=marco.crivellari@suse.com \
    --cc=mark.einon@gmail.com \
    --cc=mbloch@nvidia.com \
    --cc=mengyuanlou@net-swift.com \
    --cc=mingo@kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=msp@baylibre.com \
    --cc=nathan@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nic_swsd@realtek.com \
    --cc=oss-drivers@corigine.com \
    --cc=pabeni@redhat.com \
    --cc=petrm@nvidia.com \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=rdunlap@infradead.org \
    --cc=richardcochran@gmail.com \
    --cc=rmody@marvell.com \
    --cc=romieu@fr.zoreil.com \
    --cc=saeedm@nvidia.com \
    --cc=shaojijie@huawei.com \
    --cc=shenjian15@huawei.com \
    --cc=stas.yakovlev@gmail.com \
    --cc=tariqt@nvidia.com \
    --cc=tglx@kernel.org \
    --cc=u.kleine-koenig@baylibre.com \
    --cc=vadim.fedorenko@linux.dev \
    --cc=venza@brownhat.org \
    --cc=yiconghui@gmail.com \
    --cc=yyyynoom@gmail.com \
    --cc=zilin@seu.edu.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox