mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 0/2] i2c: Consistently define pci_device_ids using named initializers
@ 2026-05-22 20:35 Uwe Kleine-König (The Capable Hub)
  2026-05-22 20:35 ` [PATCH v2 1/2] i2c: designware-pcidrv: " Uwe Kleine-König (The Capable Hub)
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Uwe Kleine-König (The Capable Hub) @ 2026-05-22 20:35 UTC (permalink / raw)
  To: Mika Westerberg, Andi Shyti
  Cc: Andy Shevchenko, Jan Dabros, linux-i2c, linux-kernel

Hello,

Changes since (implicit) v1 (available at
https://lore.kernel.org/all/20260504142639.2119645-2-u.kleine-koenig@baylibre.com/
):

 - split by driver (requested by Andy)

Andy also suggested to use PCI_DEVICE_DATA() in the designware driver. I didn't
implement that, because I think its advantages don't outweight its downsides.
We two already discussed that in other threads where I sent similar patches and
didn't find a compromise. I think
https://lore.kernel.org/all/af7yKdRdDSJjkoIk@monoceros/ is the most detailed
discussion if you want to read about our arguments.

Best regards
Uwe

Uwe Kleine-König (The Capable Hub) (2):
  i2c: designware-pcidrv: Consistently define pci_device_ids using named
    initializers
  i2c: eg20t: Consistently define pci_device_ids using named
    initializers

 drivers/i2c/busses/i2c-designware-pcidrv.c | 78 +++++++++++-----------
 drivers/i2c/busses/i2c-eg20t.c             | 10 +--
 2 files changed, 44 insertions(+), 44 deletions(-)


base-commit: 254f49634ee16a731174d2ae34bc50bd5f45e731
-- 
2.47.3

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 1/2] i2c: designware-pcidrv: Consistently define pci_device_ids using named initializers
  2026-05-22 20:35 [PATCH v2 0/2] i2c: Consistently define pci_device_ids using named initializers Uwe Kleine-König (The Capable Hub)
@ 2026-05-22 20:35 ` Uwe Kleine-König (The Capable Hub)
  2026-05-25  4:44   ` Mika Westerberg
  2026-05-22 20:35 ` [PATCH v2 2/2] i2c: eg20t: " Uwe Kleine-König (The Capable Hub)
  2026-06-09  8:11 ` [PATCH v2 0/2] i2c: " Andi Shyti
  2 siblings, 1 reply; 5+ messages in thread
From: Uwe Kleine-König (The Capable Hub) @ 2026-05-22 20:35 UTC (permalink / raw)
  To: Mika Westerberg, Andi Shyti
  Cc: Andy Shevchenko, Jan Dabros, linux-i2c, linux-kernel

The .driver_data member of the struct pci_device_id array 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
array. Tested on x86 and arm64.

Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
---
 drivers/i2c/busses/i2c-designware-pcidrv.c | 78 +++++++++++-----------
 1 file changed, 39 insertions(+), 39 deletions(-)

diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c
index f21f9877c040..aa358eb6656d 100644
--- a/drivers/i2c/busses/i2c-designware-pcidrv.c
+++ b/drivers/i2c/busses/i2c-designware-pcidrv.c
@@ -308,51 +308,51 @@ static void i2c_dw_pci_remove(struct pci_dev *pdev)
 
 static const struct pci_device_id i2c_designware_pci_ids[] = {
 	/* Medfield */
-	{ PCI_VDEVICE(INTEL, 0x0817), medfield },
-	{ PCI_VDEVICE(INTEL, 0x0818), medfield },
-	{ PCI_VDEVICE(INTEL, 0x0819), medfield },
-	{ PCI_VDEVICE(INTEL, 0x082C), medfield },
-	{ PCI_VDEVICE(INTEL, 0x082D), medfield },
-	{ PCI_VDEVICE(INTEL, 0x082E), medfield },
+	{ PCI_VDEVICE(INTEL, 0x0817), .driver_data = medfield },
+	{ PCI_VDEVICE(INTEL, 0x0818), .driver_data = medfield },
+	{ PCI_VDEVICE(INTEL, 0x0819), .driver_data = medfield },
+	{ PCI_VDEVICE(INTEL, 0x082C), .driver_data = medfield },
+	{ PCI_VDEVICE(INTEL, 0x082D), .driver_data = medfield },
+	{ PCI_VDEVICE(INTEL, 0x082E), .driver_data = medfield },
 	/* Merrifield */
-	{ PCI_VDEVICE(INTEL, 0x1195), merrifield },
-	{ PCI_VDEVICE(INTEL, 0x1196), merrifield },
+	{ PCI_VDEVICE(INTEL, 0x1195), .driver_data = merrifield },
+	{ PCI_VDEVICE(INTEL, 0x1196), .driver_data = merrifield },
 	/* Baytrail */
-	{ PCI_VDEVICE(INTEL, 0x0F41), baytrail },
-	{ PCI_VDEVICE(INTEL, 0x0F42), baytrail },
-	{ PCI_VDEVICE(INTEL, 0x0F43), baytrail },
-	{ PCI_VDEVICE(INTEL, 0x0F44), baytrail },
-	{ PCI_VDEVICE(INTEL, 0x0F45), baytrail },
-	{ PCI_VDEVICE(INTEL, 0x0F46), baytrail },
-	{ PCI_VDEVICE(INTEL, 0x0F47), baytrail },
+	{ PCI_VDEVICE(INTEL, 0x0F41), .driver_data = baytrail },
+	{ PCI_VDEVICE(INTEL, 0x0F42), .driver_data = baytrail },
+	{ PCI_VDEVICE(INTEL, 0x0F43), .driver_data = baytrail },
+	{ PCI_VDEVICE(INTEL, 0x0F44), .driver_data = baytrail },
+	{ PCI_VDEVICE(INTEL, 0x0F45), .driver_data = baytrail },
+	{ PCI_VDEVICE(INTEL, 0x0F46), .driver_data = baytrail },
+	{ PCI_VDEVICE(INTEL, 0x0F47), .driver_data = baytrail },
 	/* Haswell */
-	{ PCI_VDEVICE(INTEL, 0x9c61), haswell },
-	{ PCI_VDEVICE(INTEL, 0x9c62), haswell },
+	{ PCI_VDEVICE(INTEL, 0x9c61), .driver_data = haswell },
+	{ PCI_VDEVICE(INTEL, 0x9c62), .driver_data = haswell },
 	/* Braswell / Cherrytrail */
-	{ PCI_VDEVICE(INTEL, 0x22C1), cherrytrail },
-	{ PCI_VDEVICE(INTEL, 0x22C2), cherrytrail },
-	{ PCI_VDEVICE(INTEL, 0x22C3), cherrytrail },
-	{ PCI_VDEVICE(INTEL, 0x22C4), cherrytrail },
-	{ PCI_VDEVICE(INTEL, 0x22C5), cherrytrail },
-	{ PCI_VDEVICE(INTEL, 0x22C6), cherrytrail },
-	{ PCI_VDEVICE(INTEL, 0x22C7), cherrytrail },
+	{ PCI_VDEVICE(INTEL, 0x22C1), .driver_data = cherrytrail },
+	{ PCI_VDEVICE(INTEL, 0x22C2), .driver_data = cherrytrail },
+	{ PCI_VDEVICE(INTEL, 0x22C3), .driver_data = cherrytrail },
+	{ PCI_VDEVICE(INTEL, 0x22C4), .driver_data = cherrytrail },
+	{ PCI_VDEVICE(INTEL, 0x22C5), .driver_data = cherrytrail },
+	{ PCI_VDEVICE(INTEL, 0x22C6), .driver_data = cherrytrail },
+	{ PCI_VDEVICE(INTEL, 0x22C7), .driver_data = cherrytrail },
 	/* Elkhart Lake (PSE I2C) */
-	{ PCI_VDEVICE(INTEL, 0x4bb9), elkhartlake },
-	{ PCI_VDEVICE(INTEL, 0x4bba), elkhartlake },
-	{ PCI_VDEVICE(INTEL, 0x4bbb), elkhartlake },
-	{ PCI_VDEVICE(INTEL, 0x4bbc), elkhartlake },
-	{ PCI_VDEVICE(INTEL, 0x4bbd), elkhartlake },
-	{ PCI_VDEVICE(INTEL, 0x4bbe), elkhartlake },
-	{ PCI_VDEVICE(INTEL, 0x4bbf), elkhartlake },
-	{ PCI_VDEVICE(INTEL, 0x4bc0), elkhartlake },
+	{ PCI_VDEVICE(INTEL, 0x4bb9), .driver_data = elkhartlake },
+	{ PCI_VDEVICE(INTEL, 0x4bba), .driver_data = elkhartlake },
+	{ PCI_VDEVICE(INTEL, 0x4bbb), .driver_data = elkhartlake },
+	{ PCI_VDEVICE(INTEL, 0x4bbc), .driver_data = elkhartlake },
+	{ PCI_VDEVICE(INTEL, 0x4bbd), .driver_data = elkhartlake },
+	{ PCI_VDEVICE(INTEL, 0x4bbe), .driver_data = elkhartlake },
+	{ PCI_VDEVICE(INTEL, 0x4bbf), .driver_data = elkhartlake },
+	{ PCI_VDEVICE(INTEL, 0x4bc0), .driver_data = elkhartlake },
 	/* AMD NAVI */
-	{ PCI_VDEVICE(ATI,  0x7314), navi_amd },
-	{ PCI_VDEVICE(ATI,  0x73a4), navi_amd },
-	{ PCI_VDEVICE(ATI,  0x73e4), navi_amd },
-	{ PCI_VDEVICE(ATI,  0x73c4), navi_amd },
-	{ PCI_VDEVICE(ATI,  0x7444), navi_amd },
-	{ PCI_VDEVICE(ATI,  0x7464), navi_amd },
-	{}
+	{ PCI_VDEVICE(ATI,  0x7314), .driver_data = navi_amd },
+	{ PCI_VDEVICE(ATI,  0x73a4), .driver_data = navi_amd },
+	{ PCI_VDEVICE(ATI,  0x73e4), .driver_data = navi_amd },
+	{ PCI_VDEVICE(ATI,  0x73c4), .driver_data = navi_amd },
+	{ PCI_VDEVICE(ATI,  0x7444), .driver_data = navi_amd },
+	{ PCI_VDEVICE(ATI,  0x7464), .driver_data = navi_amd },
+	{ }
 };
 MODULE_DEVICE_TABLE(pci, i2c_designware_pci_ids);
 
-- 
2.47.3


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 2/2] i2c: eg20t: Consistently define pci_device_ids using named initializers
  2026-05-22 20:35 [PATCH v2 0/2] i2c: Consistently define pci_device_ids using named initializers Uwe Kleine-König (The Capable Hub)
  2026-05-22 20:35 ` [PATCH v2 1/2] i2c: designware-pcidrv: " Uwe Kleine-König (The Capable Hub)
@ 2026-05-22 20:35 ` Uwe Kleine-König (The Capable Hub)
  2026-06-09  8:11 ` [PATCH v2 0/2] i2c: " Andi Shyti
  2 siblings, 0 replies; 5+ messages in thread
From: Uwe Kleine-König (The Capable Hub) @ 2026-05-22 20:35 UTC (permalink / raw)
  To: Andi Shyti; +Cc: linux-i2c, linux-kernel

The .driver_data member of the struct pci_device_id array 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) <u.kleine-koenig@baylibre.com>
---
 drivers/i2c/busses/i2c-eg20t.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/i2c/busses/i2c-eg20t.c b/drivers/i2c/busses/i2c-eg20t.c
index f83238868802..8c67ab4f2aad 100644
--- a/drivers/i2c/busses/i2c-eg20t.c
+++ b/drivers/i2c/busses/i2c-eg20t.c
@@ -169,11 +169,11 @@ static DEFINE_MUTEX(pch_mutex);
 #define PCI_DEVICE_ID_ML7831_I2C	0x8817
 
 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 },
+	{ }
 };
 MODULE_DEVICE_TABLE(pci, pch_pcidev_id);
 
-- 
2.47.3


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 1/2] i2c: designware-pcidrv: Consistently define pci_device_ids using named initializers
  2026-05-22 20:35 ` [PATCH v2 1/2] i2c: designware-pcidrv: " Uwe Kleine-König (The Capable Hub)
@ 2026-05-25  4:44   ` Mika Westerberg
  0 siblings, 0 replies; 5+ messages in thread
From: Mika Westerberg @ 2026-05-25  4:44 UTC (permalink / raw)
  To: Uwe Kleine-König (The Capable Hub)
  Cc: Andi Shyti, Andy Shevchenko, Jan Dabros, linux-i2c, linux-kernel

On Fri, May 22, 2026 at 10:35:13PM +0200, Uwe Kleine-König (The Capable Hub) wrote:
> The .driver_data member of the struct pci_device_id array 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
> array. Tested on x86 and arm64.
> 
> Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>

Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 0/2] i2c: Consistently define pci_device_ids using named initializers
  2026-05-22 20:35 [PATCH v2 0/2] i2c: Consistently define pci_device_ids using named initializers Uwe Kleine-König (The Capable Hub)
  2026-05-22 20:35 ` [PATCH v2 1/2] i2c: designware-pcidrv: " Uwe Kleine-König (The Capable Hub)
  2026-05-22 20:35 ` [PATCH v2 2/2] i2c: eg20t: " Uwe Kleine-König (The Capable Hub)
@ 2026-06-09  8:11 ` Andi Shyti
  2 siblings, 0 replies; 5+ messages in thread
From: Andi Shyti @ 2026-06-09  8:11 UTC (permalink / raw)
  To: Uwe Kleine-König (The Capable Hub)
  Cc: Mika Westerberg, Andy Shevchenko, Jan Dabros, linux-i2c, linux-kernel

Hi Uwe,

> Uwe Kleine-König (The Capable Hub) (2):
>   i2c: designware-pcidrv: Consistently define pci_device_ids using named
>     initializers
>   i2c: eg20t: Consistently define pci_device_ids using named
>     initializers

merged to i2c/i2c-host.

Thanks,
Andi

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-06-09  8:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-22 20:35 [PATCH v2 0/2] i2c: Consistently define pci_device_ids using named initializers Uwe Kleine-König (The Capable Hub)
2026-05-22 20:35 ` [PATCH v2 1/2] i2c: designware-pcidrv: " Uwe Kleine-König (The Capable Hub)
2026-05-25  4:44   ` Mika Westerberg
2026-05-22 20:35 ` [PATCH v2 2/2] i2c: eg20t: " Uwe Kleine-König (The Capable Hub)
2026-06-09  8:11 ` [PATCH v2 0/2] i2c: " Andi Shyti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome