[PATCH v1 2/2] hwmon: Use named initializers for platform_device_id arrays
From: Uwe Kleine-König (The Capable Hub)
Date: Wed May 27 2026 - 11:23:05 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 unit.
While touching these arrays usage of commas.
Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@xxxxxxxxxxxx>
---
drivers/hwmon/max197.c | 4 ++--
drivers/hwmon/ntc_thermistor.c | 24 ++++++++++++------------
drivers/hwmon/sht15.c | 10 +++++-----
3 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/drivers/hwmon/max197.c b/drivers/hwmon/max197.c
index f0048ff37607..9b6ab050db1b 100644
--- a/drivers/hwmon/max197.c
+++ b/drivers/hwmon/max197.c
@@ -321,8 +321,8 @@ static void max197_remove(struct platform_device *pdev)
}
static const struct platform_device_id max197_device_ids[] = {
- { "max197", max197 },
- { "max199", max199 },
+ { .name = "max197", .driver_data = max197 },
+ { .name = "max199", .driver_data = max199 },
{ }
};
MODULE_DEVICE_TABLE(platform, max197_device_ids);
diff --git a/drivers/hwmon/ntc_thermistor.c b/drivers/hwmon/ntc_thermistor.c
index d6b48178343d..6f82a6c49393 100644
--- a/drivers/hwmon/ntc_thermistor.c
+++ b/drivers/hwmon/ntc_thermistor.c
@@ -52,18 +52,18 @@ enum {
};
static const struct platform_device_id ntc_thermistor_id[] = {
- [NTC_B57330V2103] = { "b57330v2103", TYPE_B57330V2103 },
- [NTC_B57891S0103] = { "b57891s0103", TYPE_B57891S0103 },
- [NTC_NCP03WB473] = { "ncp03wb473", TYPE_NCPXXWB473 },
- [NTC_NCP03WF104] = { "ncp03wf104", TYPE_NCPXXWF104 },
- [NTC_NCP15WB473] = { "ncp15wb473", TYPE_NCPXXWB473 },
- [NTC_NCP15WL333] = { "ncp15wl333", TYPE_NCPXXWL333 },
- [NTC_NCP15XH103] = { "ncp15xh103", TYPE_NCPXXXH103 },
- [NTC_NCP18WB473] = { "ncp18wb473", TYPE_NCPXXWB473 },
- [NTC_NCP21WB473] = { "ncp21wb473", TYPE_NCPXXWB473 },
- [NTC_SSG1404001221] = { "ssg1404_001221", TYPE_NCPXXWB473 },
- [NTC_NCP18WM474] = { "ncp18wm474", TYPE_NCPXXWM474 },
- [NTC_LAST] = { },
+ [NTC_B57330V2103] = { .name = "b57330v2103", .driver_data = TYPE_B57330V2103 },
+ [NTC_B57891S0103] = { .name = "b57891s0103", .driver_data = TYPE_B57891S0103 },
+ [NTC_NCP03WB473] = { .name = "ncp03wb473", .driver_data = TYPE_NCPXXWB473 },
+ [NTC_NCP03WF104] = { .name = "ncp03wf104", .driver_data = TYPE_NCPXXWF104 },
+ [NTC_NCP15WB473] = { .name = "ncp15wb473", .driver_data = TYPE_NCPXXWB473 },
+ [NTC_NCP15WL333] = { .name = "ncp15wl333", .driver_data = TYPE_NCPXXWL333 },
+ [NTC_NCP15XH103] = { .name = "ncp15xh103", .driver_data = TYPE_NCPXXXH103 },
+ [NTC_NCP18WB473] = { .name = "ncp18wb473", .driver_data = TYPE_NCPXXWB473 },
+ [NTC_NCP21WB473] = { .name = "ncp21wb473", .driver_data = TYPE_NCPXXWB473 },
+ [NTC_SSG1404001221] = { .name = "ssg1404_001221", .driver_data = TYPE_NCPXXWB473 },
+ [NTC_NCP18WM474] = { .name = "ncp18wm474", .driver_data = TYPE_NCPXXWM474 },
+ [NTC_LAST] = { }
};
MODULE_DEVICE_TABLE(platform, ntc_thermistor_id);
diff --git a/drivers/hwmon/sht15.c b/drivers/hwmon/sht15.c
index 3d55047e9baf..101cebbe68e4 100644
--- a/drivers/hwmon/sht15.c
+++ b/drivers/hwmon/sht15.c
@@ -1036,11 +1036,11 @@ static void sht15_remove(struct platform_device *pdev)
}
static const struct platform_device_id sht15_device_ids[] = {
- { "sht10", sht10 },
- { "sht11", sht11 },
- { "sht15", sht15 },
- { "sht71", sht71 },
- { "sht75", sht75 },
+ { .name = "sht10", .driver_data = sht10 },
+ { .name = "sht11", .driver_data = sht11 },
+ { .name = "sht15", .driver_data = sht15 },
+ { .name = "sht71", .driver_data = sht71 },
+ { .name = "sht75", .driver_data = sht75 },
{ }
};
MODULE_DEVICE_TABLE(platform, sht15_device_ids);
--
2.47.3