From: "Markus Schneider-Pargmann" <msp@baylibre.com>
To: "Uwe Kleine-König (The Capable Hub)"
<u.kleine-koenig@baylibre.com>,
"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: "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>,
"Sudarsana Kalluru" <skalluru@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>,
"Peiyang Wang" <wangpeiyang1@huawei.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>,
"Chi-hsien Lin" <chi-hsien.lin@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 10:55:14 +0200 [thread overview]
Message-ID: <DI6D3JVJ6JG6.8V4XUVGJA2D4@baylibre.com> (raw)
In-Reply-To: <20260428171845.2288395-2-u.kleine-koenig@baylibre.com>
[-- Attachment #1: Type: text/plain, Size: 2572 bytes --]
Hi Uwe,
On Tue Apr 28, 2026 at 7:18 PM CEST, 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>
> ---
> 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
> ---
[...]
> diff --git a/drivers/net/can/m_can/m_can_pci.c b/drivers/net/can/m_can/m_can_pci.c
> index eb31ed1f9644..cb9335c1d3ea 100644
> --- a/drivers/net/can/m_can/m_can_pci.c
> +++ b/drivers/net/can/m_can/m_can_pci.c
> @@ -183,9 +183,9 @@ static SIMPLE_DEV_PM_OPS(m_can_pci_pm_ops,
> m_can_pci_suspend, m_can_pci_resume);
>
> static const struct pci_device_id m_can_pci_id_table[] = {
> - { PCI_VDEVICE(INTEL, 0x4bc1), M_CAN_CLOCK_FREQ_EHL, },
> - { PCI_VDEVICE(INTEL, 0x4bc2), M_CAN_CLOCK_FREQ_EHL, },
> - { } /* Terminating Entry */
> + { PCI_VDEVICE(INTEL, 0x4bc1), .driver_data = M_CAN_CLOCK_FREQ_EHL, },
> + { PCI_VDEVICE(INTEL, 0x4bc2), .driver_data = M_CAN_CLOCK_FREQ_EHL, },
> + { } /* terminating entry */
M_CAN_CLOCK_FREQ_EHL is basically hardcoded for all PCI devices since
2020. I don't think we need this driver data at all and can just drop it
and use M_CAN_CLOCK_FREQ_EHL directly in the code for the frequency.
Once a real new PCI device gets added we can see if and what driver_data
is needed.
Best
Markus
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 289 bytes --]
next prev parent reply other threads:[~2026-04-30 8:55 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)
2026-04-30 8:55 ` Markus Schneider-Pargmann [this message]
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=DI6D3JVJ6JG6.8V4XUVGJA2D4@baylibre.com \
--to=msp@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=chi-hsien.lin@cypress.com \
--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=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=skalluru@marvell.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=wangpeiyang1@huawei.com \
--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