[PATCH v1] iio: Use named initializers for platform_device_id arrays
From: Uwe Kleine-König (The Capable Hub)
Date: Thu May 28 2026 - 06:27:32 EST
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@xxxxxxxxxxxx>
---
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