Re: [PATCH] x86/platform/intel-mid: Use named initializer for pci_device_id array
From: Andy Shevchenko
Date: Thu May 07 2026 - 13:25:15 EST
On Thu, May 7, 2026 at 6:40 PM Uwe Kleine-König (The Capable Hub)
<u.kleine-koenig@xxxxxxxxxxxx> wrote:
>
> While being more verbose using a named initializer yields easier to
> understand code and doesn't rely on the two hidden zeros in the
> PCI_VDEVICE macro.
>
> This doesn't introduce any changes to the compiled result of the array,
> which was confirmed with an ARCH=x86 build.
Instead you can modify PCI_DEVICE_DATA() to accept different types and
act accordingly, no need for this churn in the drivers.
> /* This table should be in sync with the one in drivers/pci/pci-mid.c */
> static const struct pci_device_id mid_pwr_pci_ids[] = {
> - { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_PENWELL), .driver_data = (kernel_ulong_t)&pnw_info },
> - { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_TANGIER), .driver_data = (kernel_ulong_t)&tng_info },
> + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_PENWELL), .driver_data_ptr = &pnw_info },
> + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_TANGIER), .driver_data_ptr = &tng_info },
> {}
> };
...
> static const struct pci_device_id mid_pwr_pci_ids[] = {
> - { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_PENWELL), (kernel_ulong_t)&pnw_info },
> - { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_TANGIER), (kernel_ulong_t)&tng_info },
> + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_PENWELL), .driver_data = (kernel_ulong_t)&pnw_info },
> + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_TANGIER), .driver_data = (kernel_ulong_t)&tng_info },
> {}
> };
Just use PCI_DEVICE_DATA() here and do whatever you want in the future
there, once for all.
--
With Best Regards,
Andy Shevchenko