[v1] iio: Use named initializers for platform_device_id arrays
Commit Message
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(-)
base-commit: e7d700e14934e68f86338c5610cf2ae76798b663
Comments
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
@@ -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);
@@ -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);
@@ -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);