Re: [PATCH] i2c: Consistently define pci_device_ids using named initializers
From: Andy Shevchenko
Date: Mon May 04 2026 - 10:51:42 EST
On Mon, May 04, 2026 at 04:26:39PM +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. Also skip explicit assignments of 0 (which the compiler then
> takes care of).
>
> This change doesn't introduce changes to the compiled pci_device_id
> arrays. Tested on x86 and arm64.
Split by driver, please.
...
> static const struct pci_device_id pch_pcidev_id[] = {
> - { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_PCH_I2C), 1, },
> - { PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ML7213_I2C), 2, },
> - { PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ML7223_I2C), 1, },
> - { PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ML7831_I2C), 1, },
> - {0,}
> + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_PCH_I2C), .driver_data = 1 },
> + { PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ML7213_I2C), .driver_data = 2 },
> + { PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ML7223_I2C), .driver_data = 1 },
> + { PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ML7831_I2C), .driver_data = 1 },
> + { }
This may gain with PCI_DEVICE_DATA().
> };
...
The second driver is fine to me.
--
With Best Regards,
Andy Shevchenko