public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Uwe Kleine-König (The Capable Hub)" <u.kleine-koenig@baylibre.com>
To: Jijie Shao <shaojijie@huawei.com>
Cc: 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>,
	Markus Schneider-Pargmann <msp@baylibre.com>,
	 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>,
	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>,
	Simon Horman <horms@kernel.org>,
	 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>, Thomas Gleixner <tglx@kernel.org>,
	 Thomas Fourier <fourier.thomas@gmail.com>,
	Ingo Molnar <mingo@kernel.org>,
	 Kory Maincent <kory.maincent@bootlin.com>,
	Zilin Guan <zilin@seu.edu.cn>,
	 Marco Crivellari <marco.crivellari@suse.com>,
	Vadim Fedorenko <vadim.fedorenko@linux.dev>,
	 Jacob Keller <jacob.e.keller@intel.com>,
	Philipp Stanner <phasta@kernel.org>,
	 Bjorn Helgaas <bhelgaas@google.com>,
	Yeounsu Moon <yyyynoom@gmail.com>,
	 Denis Benato <benato.denis96@gmail.com>,
	Yonglong Liu <liuyonglong@huawei.com>,
	 Andy Shevchenko <andriy.shevchenko@intel.com>,
	Yicong Hui <yiconghui@gmail.com>,
	 Randy Dunlap <rdunlap@infradead.org>,
	MD Danish Anwar <danishanwar@ti.com>,
	 Nathan Chancellor <nathan@kernel.org>,
	Sai Krishna <saikrishnag@marvell.com>,
	 Ethan Nelson-Moore <enelsonmoore@gmail.com>,
	Larysa Zaremba <larysa.zaremba@intel.com>,
	 Joe Damato <joe@dama.to>, Double Lo <double.lo@cypress.com>,
	 Colin Ian King <colin.i.king@gmail.com>,
	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] net: Consistently define pci_device_ids using named initializers
Date: Thu, 30 Apr 2026 15:13:13 +0200	[thread overview]
Message-ID: <afNUNeIsN4MrjWN7@monoceros> (raw)
In-Reply-To: <814632c8-070b-4b21-adbb-5a01a62d52f2@huawei.com>

[-- Attachment #1: Type: text/plain, Size: 2618 bytes --]

Hello,

On Thu, Apr 30, 2026 at 02:53:29PM +0800, Jijie Shao wrote:
> on 2026/4/29 1:18, 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.
> > 
> > Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
> 
> ...
> 
> > diff --git a/drivers/net/ethernet/hisilicon/hibmcge/hbg_main.c b/drivers/net/ethernet/hisilicon/hibmcge/hbg_main.c
> > index 068da2fd1fea..b3e01b2f8319 100644
> > --- a/drivers/net/ethernet/hisilicon/hibmcge/hbg_main.c
> > +++ b/drivers/net/ethernet/hisilicon/hibmcge/hbg_main.c
> > @@ -489,7 +489,7 @@ static void hbg_shutdown(struct pci_dev *pdev)
> >   }
> >   static const struct pci_device_id hbg_pci_tbl[] = {
> > -	{PCI_VDEVICE(HUAWEI, 0x3730), 0},
> > +	{ PCI_VDEVICE(HUAWEI, 0x3730) },
> >   	{ }
> >   };
> 
> Reviewed-by: Jijie Shao <shaojijie@huawei.com>

Thanks.

> > +	{
> > +		PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_GE),
> > +		.driver_data = 0,
> > +	}, {
> > +		PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_25GE),
> > +		.driver_data = 0,
> 
> Thanks for your work.
> 
> If .driver_data = 0, is it possible to delete it to be consistent with other parts, for example:
> 
> { PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_GE) }
> 
> > +	}, {
> > +		PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_25GE_RDMA),
> > +		.driver_data = HNAE3_DEV_SUPPORT_ROCE_DCB_BITS,

However keeping the explicit .driver_data = 0 to have a contrast to
other `pci_device_id`s having a non-zero .driver_data in the same driver
is also a good reason to keep the (technically redundant) assignment.
For other drivers I dropped these assignments if this is possible for
all array members.

Having said that I don't intend to rework the patch for this suggestion.

Best regards
Uwe

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2026-04-30 13:13 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-28 17:18 [PATCH net-next] net: Consistently define pci_device_ids using named initializers Uwe Kleine-König (The Capable Hub)
2026-04-28 19:35 ` Johannes Berg
2026-04-28 22:24 ` Jacob Keller
2026-04-29  6:54 ` Andy Shevchenko
2026-04-29 10:26   ` Uwe Kleine-König (The Capable Hub)
2026-04-29  8:48 ` Petr Machata
2026-04-29  9:10 ` Marc Kleine-Budde
2026-04-29 10:30   ` Uwe Kleine-König (The Capable Hub)
2026-04-29  9:19 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-04-30  6:53 ` Jijie Shao
2026-04-30 13:13   ` Uwe Kleine-König (The Capable Hub) [this message]
2026-04-30  8:55 ` Markus Schneider-Pargmann
2026-04-30 13:15   ` Uwe Kleine-König (The Capable Hub)
2026-04-30 15:14 ` Arend van Spriel

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=afNUNeIsN4MrjWN7@monoceros \
    --to=u.kleine-koenig@baylibre.com \
    --cc=GR-Linux-NIC-Dev@marvell.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=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=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=joe@dama.to \
    --cc=johannes@sipsolutions.net \
    --cc=kees@kernel.org \
    --cc=kevin.curtis@farsite.co.uk \
    --cc=khc@pm.waw.pl \
    --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=m.grzeschik@pengutronix.de \
    --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=phasta@kernel.org \
    --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=saikrishnag@marvell.com \
    --cc=shaojijie@huawei.com \
    --cc=shenjian15@huawei.com \
    --cc=stas.yakovlev@gmail.com \
    --cc=tariqt@nvidia.com \
    --cc=tglx@kernel.org \
    --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