From: "Uwe Kleine-König (The Capable Hub)" <u.kleine-koenig@baylibre.com>
To: Andy Shevchenko <andriy.shevchenko@intel.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>,
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>,
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>,
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: Wed, 29 Apr 2026 12:26:32 +0200 [thread overview]
Message-ID: <afHbcwzVucHRYmDW@monoceros> (raw)
In-Reply-To: <afGrPvUeZ-DjWbC8@ashevche-desk.local>
[-- Attachment #1: Type: text/plain, Size: 3039 bytes --]
[I dropped a few addresses from Cc: that bounced for me before.]
Hello Andy,
On Wed, Apr 29, 2026 at 09:54:54AM +0300, Andy Shevchenko wrote:
> On Tue, Apr 28, 2026 at 07:18:44PM +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.
>
> ...
>
> > - {0,} /* 0 terminated list. */
> > + { } /* 0 terminated list. */
>
> The comments like these are just noises.
Agreed, but I'd consider it out of scope for this patch to drop these
comments. That might also be subjective.
> The rule of thumb is to play with a
> trailing comma:
> - always drop it in the terminator entry
> - always keep it in the normal initialisers when semantically it's not a
> terminator
That was my intention. Will rework.
> > static const struct pci_device_id liquidio_pci_tbl[] = {
> > { /* 68xx */
> > - PCI_VENDOR_ID_CAVIUM, 0x91, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0
> > + PCI_VDEVICE(CAVIUM, 0x91)
>
> Use full fixed-width device id value(s). 0x0091 here and so on...
Sounds fair.
> > },
>
> Also seems that you may decrease number of LoC here putting it as
>
> { PCI_VDEVICE(CAVIUM, 0x0091) }, /* 68xx */
>
> and so on...
Agreed if all lines of an array can be compressed like that.
> > { /* 66xx */
> > - PCI_VENDOR_ID_CAVIUM, 0x92, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0
> > + PCI_VDEVICE(CAVIUM, 0x92)
> > },
> > { /* 23xx pf */
> > - PCI_VENDOR_ID_CAVIUM, 0x9702, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0
> > + PCI_VDEVICE(CAVIUM, 0x9702)
> > },
> > - {
> > - 0, 0, 0, 0, 0, 0, 0
> > - }
> > + { }
> > };
>
> ...
>
> > #define CH_PCI_DEVICE_ID_TABLE_DEFINE_END \
> > - { 0, } \
> > + { } \
> > }
>
> Why do we have this macro at all?
Over engineering? Reworking that also seems to be out of scope for this
patch to me.
> Also I somehow managed to remove, but I remember you had an inner comma in some
> cases after the .driver_data, when the full ID entry is located on a single
> line. I.o.w. do
>
> { PCI_...(), .driver_data = ... // no trailing comma here! },
That was also my intention. Will rework.
Best regards
Uwe
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: "Uwe Kleine-König (The Capable Hub)" <u.kleine-koenig@baylibre.com>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: Cai Huoqing <cai.huoqing@linux.dev>,
Marco Crivellari <marco.crivellari@suse.com>,
Randy Dunlap <rdunlap@infradead.org>,
Yonglong Liu <liuyonglong@huawei.com>,
Kees Cook <kees@kernel.org>,
linux-wireless@vger.kernel.org,
Larysa Zaremba <larysa.zaremba@intel.com>,
Joe Damato <joe@dama.to>,
brcm80211@lists.linux.dev, Daniele Venzano <venza@brownhat.org>,
Eric Dumazet <edumazet@google.com>,
Tony Nguyen <anthony.l.nguyen@intel.com>,
MD Danish Anwar <danishanwar@ti.com>,
Richard Cochran <richardcochran@gmail.com>,
Samuel Chessman <chessman@tux.org>,
Fan Gong <gongfan1@huawei.com>,
Mengyuan Lou <mengyuanlou@net-swift.com>,
Kevin Curtis <kevin.curtis@farsite.co.uk>,
Ingo Molnar <mingo@kernel.org>, Ion Badulescu <ionut@badula.org>,
Michael Grzeschik <m.grzeschik@pengutronix.de>,
Yeounsu Moon <yyyynoom@gmail.com>,
Manish Chopra <manishc@marvell.com>,
Colin Ian King <colin.i.king@gmail.com>,
Przemek Kitszel <przemyslaw.kitszel@intel.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,
Jacob Keller <jacob.e.keller@intel.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.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>,
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>,
Marc Kleine-Budde <mkl@pengutronix.de>,
Bjorn Helgaas <bhelgaas@google.com>,
Zilin Guan <zilin@seu.edu.cn>,
linux-can@vger.kernel.org, Yibo Dong <dong100@mucse.com>,
Ethan Nelson-Moore <enelsonmoore@gmail.com>,
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>,
Leon Romanovsky <leon@kernel.org>,
Denis Benato <benato.denis96@gmail.com>,
Rasesh Mody <rmody@marvell.com>,
netdev@vger.kernel.org, oss-drivers@corigine.com,
Vincent Mailhol <mailhol@kernel.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>,
Andrew Lunn <andrew+netdev@lunn.ch>,
Thomas Gleixner <tglx@kernel.org>,
Simon Horman <horms@kernel.org>, Yicong Hui <yiconghui@gmail.com>,
Mark Einon <mark.einon@gmail.com>,
Johannes Berg <johannes@sipsolutions.net>,
Heiner Kallweit <hkallweit1@gmail.com>,
Saeed Mahameed <saeedm@nvidia.com>,
"David S. Miller" <davem@davemloft.net>,
Krzysztof Halasa <khc@pm.waw.pl>
Subject: Re: [Intel-wired-lan] [PATCH net-next] net: Consistently define pci_device_ids using named initializers
Date: Wed, 29 Apr 2026 12:26:32 +0200 [thread overview]
Message-ID: <afHbcwzVucHRYmDW@monoceros> (raw)
In-Reply-To: <afGrPvUeZ-DjWbC8@ashevche-desk.local>
[-- Attachment #1: Type: text/plain, Size: 3039 bytes --]
[I dropped a few addresses from Cc: that bounced for me before.]
Hello Andy,
On Wed, Apr 29, 2026 at 09:54:54AM +0300, Andy Shevchenko wrote:
> On Tue, Apr 28, 2026 at 07:18:44PM +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.
>
> ...
>
> > - {0,} /* 0 terminated list. */
> > + { } /* 0 terminated list. */
>
> The comments like these are just noises.
Agreed, but I'd consider it out of scope for this patch to drop these
comments. That might also be subjective.
> The rule of thumb is to play with a
> trailing comma:
> - always drop it in the terminator entry
> - always keep it in the normal initialisers when semantically it's not a
> terminator
That was my intention. Will rework.
> > static const struct pci_device_id liquidio_pci_tbl[] = {
> > { /* 68xx */
> > - PCI_VENDOR_ID_CAVIUM, 0x91, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0
> > + PCI_VDEVICE(CAVIUM, 0x91)
>
> Use full fixed-width device id value(s). 0x0091 here and so on...
Sounds fair.
> > },
>
> Also seems that you may decrease number of LoC here putting it as
>
> { PCI_VDEVICE(CAVIUM, 0x0091) }, /* 68xx */
>
> and so on...
Agreed if all lines of an array can be compressed like that.
> > { /* 66xx */
> > - PCI_VENDOR_ID_CAVIUM, 0x92, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0
> > + PCI_VDEVICE(CAVIUM, 0x92)
> > },
> > { /* 23xx pf */
> > - PCI_VENDOR_ID_CAVIUM, 0x9702, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0
> > + PCI_VDEVICE(CAVIUM, 0x9702)
> > },
> > - {
> > - 0, 0, 0, 0, 0, 0, 0
> > - }
> > + { }
> > };
>
> ...
>
> > #define CH_PCI_DEVICE_ID_TABLE_DEFINE_END \
> > - { 0, } \
> > + { } \
> > }
>
> Why do we have this macro at all?
Over engineering? Reworking that also seems to be out of scope for this
patch to me.
> Also I somehow managed to remove, but I remember you had an inner comma in some
> cases after the .driver_data, when the full ID entry is located on a single
> line. I.o.w. do
>
> { PCI_...(), .driver_data = ... // no trailing comma here! },
That was also my intention. Will rework.
Best regards
Uwe
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2026-04-29 10:26 UTC|newest]
Thread overview: 28+ 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 17:18 ` [Intel-wired-lan] " Uwe Kleine-König (The Capable Hub)
2026-04-28 19:35 ` Johannes Berg
2026-04-28 19:35 ` [Intel-wired-lan] " Johannes Berg
2026-04-28 22:24 ` Jacob Keller
2026-04-28 22:24 ` [Intel-wired-lan] " Jacob Keller
2026-04-29 6:54 ` Andy Shevchenko
2026-04-29 6:54 ` [Intel-wired-lan] " Andy Shevchenko
2026-04-29 10:26 ` Uwe Kleine-König (The Capable Hub) [this message]
2026-04-29 10:26 ` Uwe Kleine-König (The Capable Hub)
2026-04-29 8:48 ` Petr Machata
2026-04-29 8:48 ` [Intel-wired-lan] " Petr Machata via Intel-wired-lan
2026-04-29 9:10 ` Marc Kleine-Budde
2026-04-29 9:10 ` [Intel-wired-lan] " Marc Kleine-Budde
2026-04-29 10:30 ` Uwe Kleine-König (The Capable Hub)
2026-04-29 10:30 ` [Intel-wired-lan] " Uwe Kleine-König (The Capable Hub)
2026-04-29 9:19 ` Loktionov, Aleksandr
2026-04-29 9:19 ` Loktionov, Aleksandr
2026-04-30 6:53 ` Jijie Shao
2026-04-30 6:53 ` [Intel-wired-lan] " Jijie Shao
2026-04-30 13:13 ` Uwe Kleine-König (The Capable Hub)
2026-04-30 13:13 ` [Intel-wired-lan] " Uwe Kleine-König (The Capable Hub)
2026-04-30 8:55 ` Markus Schneider-Pargmann
2026-04-30 8:55 ` [Intel-wired-lan] " Markus Schneider-Pargmann
2026-04-30 13:15 ` Uwe Kleine-König (The Capable Hub)
2026-04-30 13:15 ` [Intel-wired-lan] " Uwe Kleine-König (The Capable Hub)
2026-04-30 15:14 ` Arend van Spriel
2026-04-30 15:14 ` [Intel-wired-lan] " Arend van Spriel via Intel-wired-lan
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=afHbcwzVucHRYmDW@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.