Re: [PATCH net-next] net: Consistently define pci_device_ids using named initializers

Jacob Keller <[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 <[email protected]>
On 4/28/2026 10:18 AM, 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 end result is much easier to read, in my opinion. Thanks!

> The secret plan is to make struct pci_device_id::driver_data an
> anonymous union (similar to
> https://lore.kernel.org/all/[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) <[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
> ---
For the Intel driver changes:

Acked-by: Jacob Keller <[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.