public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
* [PATCH v1] iio: Use named initializers for platform_device_id arrays
@ 2026-05-28 10:16 Uwe Kleine-König (The Capable Hub)
  2026-05-28 11:58 ` Jonathan Cameron
  0 siblings, 1 reply; 2+ messages in thread
From: Uwe Kleine-König (The Capable Hub) @ 2026-05-28 10:16 UTC (permalink / raw)
  To: Jonathan Cameron, Chen-Yu Tsai
  Cc: Duje Mihanović, David Lechner, Nuno Sá, Andy Shevchenko,
	Jernej Skrabec, Samuel Holland, Wolfram Sang, Sakari Ailus,
	linux-iio, linux-kernel, linux-arm-kernel, linux-sunxi

Named initializers are better readable and more robust to changes of the
struct definition. This robustness is relevant for a planned change to
struct platform_device_id replacing .driver_data by an anonymous union.

Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre•com>
---
Hello,

I recently sent a similar patch for i2c_device_id arrays. This is the
respective change for platform_device_ids.

Best regards
Uwe

 drivers/iio/adc/88pm886-gpadc.c   | 2 +-
 drivers/iio/adc/max77541-adc.c    | 2 +-
 drivers/iio/adc/sun4i-gpadc-iio.c | 6 +++---
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/iio/adc/88pm886-gpadc.c b/drivers/iio/adc/88pm886-gpadc.c
index cffe35136685..4435f3d5e2b8 100644
--- a/drivers/iio/adc/88pm886-gpadc.c
+++ b/drivers/iio/adc/88pm886-gpadc.c
@@ -373,7 +373,7 @@ static DEFINE_RUNTIME_DEV_PM_OPS(pm886_gpadc_pm_ops,
 				 pm886_gpadc_runtime_resume, NULL);
 
 static const struct platform_device_id pm886_gpadc_id[] = {
-	{ "88pm886-gpadc" },
+	{ .name = "88pm886-gpadc" },
 	{ }
 };
 MODULE_DEVICE_TABLE(platform, pm886_gpadc_id);
diff --git a/drivers/iio/adc/max77541-adc.c b/drivers/iio/adc/max77541-adc.c
index 0aa04d143ad4..013da014bccd 100644
--- a/drivers/iio/adc/max77541-adc.c
+++ b/drivers/iio/adc/max77541-adc.c
@@ -175,7 +175,7 @@ static int max77541_adc_probe(struct platform_device *pdev)
 }
 
 static const struct platform_device_id max77541_adc_platform_id[] = {
-	{ "max77541-adc" },
+	{ .name = "max77541-adc" },
 	{ }
 };
 MODULE_DEVICE_TABLE(platform, max77541_adc_platform_id);
diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c
index 479115ea50bf..203459ca9907 100644
--- a/drivers/iio/adc/sun4i-gpadc-iio.c
+++ b/drivers/iio/adc/sun4i-gpadc-iio.c
@@ -679,9 +679,9 @@ static void sun4i_gpadc_remove(struct platform_device *pdev)
 }
 
 static const struct platform_device_id sun4i_gpadc_id[] = {
-	{ "sun4i-a10-gpadc-iio", (kernel_ulong_t)&sun4i_gpadc_data },
-	{ "sun5i-a13-gpadc-iio", (kernel_ulong_t)&sun5i_gpadc_data },
-	{ "sun6i-a31-gpadc-iio", (kernel_ulong_t)&sun6i_gpadc_data },
+	{ .name = "sun4i-a10-gpadc-iio", .driver_data = (kernel_ulong_t)&sun4i_gpadc_data },
+	{ .name = "sun5i-a13-gpadc-iio", .driver_data = (kernel_ulong_t)&sun5i_gpadc_data },
+	{ .name = "sun6i-a31-gpadc-iio", .driver_data = (kernel_ulong_t)&sun6i_gpadc_data },
 	{ }
 };
 MODULE_DEVICE_TABLE(platform, sun4i_gpadc_id);

base-commit: e7d700e14934e68f86338c5610cf2ae76798b663
-- 
2.47.3



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

* Re: [PATCH v1] iio: Use named initializers for platform_device_id arrays
  2026-05-28 10:16 [PATCH v1] iio: Use named initializers for platform_device_id arrays Uwe Kleine-König (The Capable Hub)
@ 2026-05-28 11:58 ` Jonathan Cameron
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2026-05-28 11:58 UTC (permalink / raw)
  To: Uwe Kleine-König (The Capable Hub)
  Cc: Chen-Yu Tsai, Duje Mihanović, David Lechner, Nuno Sá,
	Andy Shevchenko, Jernej Skrabec, Samuel Holland, Wolfram Sang,
	Sakari Ailus, linux-iio, linux-kernel, linux-arm-kernel,
	linux-sunxi

On Thu, 28 May 2026 12:16:49 +0200
Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre•com> wrote:

> Named initializers are better readable and more robust to changes of the
> struct definition. This robustness is relevant for a planned change to
> struct platform_device_id replacing .driver_data by an anonymous union.
> 
> Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre•com>
Applied.

thanks,
Jonathan


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

end of thread, other threads:[~2026-05-28 11:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-28 10:16 [PATCH v1] iio: Use named initializers for platform_device_id arrays Uwe Kleine-König (The Capable Hub)
2026-05-28 11:58 ` Jonathan Cameron

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