]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
hwmon: Use named initializers for platform_device_id arrays
authorUwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
Wed, 27 May 2026 15:15:53 +0000 (17:15 +0200)
committerGuenter Roeck <linux@roeck-us.net>
Tue, 9 Jun 2026 15:23:17 +0000 (08:23 -0700)
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 unify usage of commas.

Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
Link: https://lore.kernel.org/r/25d38df8db42d69f33fa30267c9fd5ea058223d0.1779894738.git.u.kleine-koenig@baylibre.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/max197.c
drivers/hwmon/ntc_thermistor.c
drivers/hwmon/sht15.c

index f0048ff376072277d35ed04e702dfdcd9020f73c..9b6ab050db1b4b799890b2633a3a1a137754709c 100644 (file)
@@ -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);
index d6b48178343dbbf268f54004c1f6e39d97fbd532..6f82a6c49393098bd67ff8dfe33c248ef96b7896 100644 (file)
@@ -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);
 
index 3d55047e9baf9ad6d45d64765c4cba772def0057..101cebbe68e4d7f8df91625b1ce51f312c40c6f2 100644 (file)
@@ -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);