Re: [PATCH] i3c: Consistently define pci_device_ids using named initializers

Uwe Kleine-König (The Capable Hub) <[email protected]>
Newsgroups org.infradead.lists.linux-i3c,org.kernel.vger.linux-kernel
Message-ID <afmEo54iWgk54M3Y@monoceros>
On Mon, May 04, 2026 at 04:42:26PM -0400, Frank Li wrote:
> On Mon, May 04, 2026 at 04:33:15PM +0200, Uwe Kleine-König (The Capable Hub) wrote:
> > The .driver_data member of the various struct pci_device_id arrays were
> > initialized by list expressions. This isn't easily readable if you're
> > not into PCI. Using named initializers is more explicit and thus easier
> > to parse.
> >
> > 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 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 IMHO it's also a nice cleanup
> > on its own.
> >
> > The anonymous union will allow changes like the following:
> >
> > -	{ PCI_VDEVICE(INTEL, 0x4d7c), .driver_data = (kernel_ulong_t)&intel_mi_1_info },
> > +	{ PCI_VDEVICE(INTEL, 0x4d7c), .driver_data_ptr = &intel_mi_1_info },
> 
> I think it is good. Can you directly change to to
> 	{ PCI_VDEVICE(INTEL, 0x4d7c), .driver_data_ptr = &intel_mi_1_info }
> 
> I think use anonymous union {.driver_data; .driver_data_ptr} don't impact
> the current drivers.

I cannot because pci_device_id with the union cannot be initialized
using

	{ PCI_VDEVICE(INTEL, 0x4d7c), (kernel_ulong_t)&intel_mi_1_info },

That's why all drivers must be adapted first to use named initializers.

Best regards
Uwe

-- 
linux-i3c mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-i3c
signature.asc (application/pgp-signature, 488 B)
-----BEGIN PGP SIGNATURE-----

iQEzBAABCgAdFiEEP4GsaTp6HlmJrf7Tj4D7WH0S/k4FAmn5hRYACgkQj4D7WH0S
/k54SAf/YUfmS/bahkAtbcQF2rt1c0OO5xZkAuZchAlANs04rLI+WiOk9KmOd/Sw
RvKZp+2C+eQAPnbzkR7IRnfJ8jz9/zIaKHYCeIZGGHhF8vJmospejGIiyp2ak5RO
y9t+oHnWOcZw5AWYkcotZXEimXIam0P6mrR2nUx0ru/0whmiocKct09gW3GW9YRd
K0jeQ9K9YpCFTcTRNCpTGP6tZ4yq3zR2VF+8lhUnuXigm53WE3tuJtKHmqM0zM5p
gkwFJ0RtbBO4bf1ulrrMKgDqz2ehlN8nwUyBfnVvGcrLXCva46c4aH29oVF6tuDz
LmjiguzDbbq2aDpktzBgzfor1eeO7Q==
=hAGU
-----END PGP SIGNATURE-----
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.