]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
backlight: Use named initializers for arrays of i2c_device_data
authorUwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
Mon, 18 May 2026 11:12:03 +0000 (13:12 +0200)
committerLee Jones <lee@kernel.org>
Thu, 11 Jun 2026 14:12:12 +0000 (15:12 +0100)
While being less compact, using named initializers allows to more easily
see which members of the structs are assigned which value without having
to lookup the declaration of the struct. And it's also more robust
against changes to the struct definition.

The mentioned robustness is relevant for a planned change to struct
i2c_device_id that replaces .driver_data by an anonymous union.

While touching all these arrays, unify usage of whitespace in the list
terminator.

This patch doesn't modify the compiled arrays, only their representation
in source form benefits. The former was confirmed with x86 and arm64
builds.

Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
Reviewed-by: Daniel Thompson (RISCstar) <danielt@kernel.org>
Link: https://patch.msgid.link/20260518111203.639603-2-u.kleine-koenig@baylibre.com
Signed-off-by: Lee Jones <lee@kernel.org>
12 files changed:
drivers/video/backlight/adp8860_bl.c
drivers/video/backlight/adp8870_bl.c
drivers/video/backlight/arcxcnn_bl.c
drivers/video/backlight/aw99706.c
drivers/video/backlight/bd6107.c
drivers/video/backlight/ktz8866.c
drivers/video/backlight/lm3509_bl.c
drivers/video/backlight/lm3630a_bl.c
drivers/video/backlight/lm3639_bl.c
drivers/video/backlight/lp855x_bl.c
drivers/video/backlight/lv5207lp.c
drivers/video/backlight/mp3309c.c

index d4bbd7a7406b0c548094fda30e556ddb8f3ac49c..09dd677024312b8cb3d5186586631704658c34d8 100644 (file)
@@ -790,9 +790,9 @@ static SIMPLE_DEV_PM_OPS(adp8860_i2c_pm_ops, adp8860_i2c_suspend,
                        adp8860_i2c_resume);
 
 static const struct i2c_device_id adp8860_id[] = {
-       { "adp8860", adp8860 },
-       { "adp8861", adp8861 },
-       { "adp8863", adp8863 },
+       { .name = "adp8860", .driver_data = adp8860 },
+       { .name = "adp8861", .driver_data = adp8861 },
+       { .name = "adp8863", .driver_data = adp8863 },
        { }
 };
 MODULE_DEVICE_TABLE(i2c, adp8860_id);
index e09e20492e7c1556f6770a1e7e32d8182bc80fba..d009f2c8a11d86c5da42691520a88b512dfa1ca1 100644 (file)
@@ -962,7 +962,7 @@ static SIMPLE_DEV_PM_OPS(adp8870_i2c_pm_ops, adp8870_i2c_suspend,
                        adp8870_i2c_resume);
 
 static const struct i2c_device_id adp8870_id[] = {
-       { "adp8870" },
+       { .name = "adp8870" },
        { }
 };
 MODULE_DEVICE_TABLE(i2c, adp8870_id);
index 1d5a570cfe022d5bcc0a0b96be165d023d3d60f3..f46eeab02e90eefeac00e2bfc9344df892dcbd2e 100644 (file)
@@ -382,7 +382,7 @@ static const struct of_device_id arcxcnn_dt_ids[] = {
 MODULE_DEVICE_TABLE(of, arcxcnn_dt_ids);
 
 static const struct i2c_device_id arcxcnn_ids[] = {
-       {"arc2c0608", ARC2C0608},
+       { .name = "arc2c0608", .driver_data = ARC2C0608 },
        { }
 };
 MODULE_DEVICE_TABLE(i2c, arcxcnn_ids);
index 938f352aaab7f82c8f3574781e77d7590f33da41..18299faf06ad46d0aba79187a963be29c4102d12 100644 (file)
@@ -443,7 +443,7 @@ static int aw99706_resume(struct device *dev)
 static DEFINE_SIMPLE_DEV_PM_OPS(aw99706_pm_ops, aw99706_suspend, aw99706_resume);
 
 static const struct i2c_device_id aw99706_ids[] = {
-       { "aw99706" },
+       { .name = "aw99706" },
        { }
 };
 MODULE_DEVICE_TABLE(i2c, aw99706_ids);
index 74567af84e97f1e310f5506e0f8619c78c0821b3..6778b4030b027535babe23d86d4cb6fcff5bde07 100644 (file)
@@ -179,7 +179,7 @@ static void bd6107_remove(struct i2c_client *client)
 }
 
 static const struct i2c_device_id bd6107_ids[] = {
-       { "bd6107" },
+       { .name = "bd6107" },
        { }
 };
 MODULE_DEVICE_TABLE(i2c, bd6107_ids);
index 351c2b4d63ed728cf4487e24d8c33a299126d350..53c1301dbb8c5a58aec33c7f51d527705dc50dba 100644 (file)
@@ -179,8 +179,8 @@ static void ktz8866_remove(struct i2c_client *client)
 }
 
 static const struct i2c_device_id ktz8866_ids[] = {
-       { "ktz8866" },
-       {}
+       { .name = "ktz8866" },
+       { }
 };
 MODULE_DEVICE_TABLE(i2c, ktz8866_ids);
 
index 24e1a19ff72d3efbed21b586bbfc2d2d50a0749a..53136c5e1460d61c39bf430c8f5f2bc1fd2ee547 100644 (file)
@@ -311,8 +311,8 @@ static void lm3509_remove(struct i2c_client *client)
 }
 
 static const struct i2c_device_id lm3509_id[] = {
-       { LM3509_NAME },
-       {}
+       { .name = LM3509_NAME },
+       { }
 };
 
 MODULE_DEVICE_TABLE(i2c, lm3509_id);
index 37651c2b939330fe29b7b82b7499e220c67a79c7..8f49e59ce374bea88d0d77002c47e043ca94426b 100644 (file)
@@ -596,8 +596,8 @@ static void lm3630a_remove(struct i2c_client *client)
 }
 
 static const struct i2c_device_id lm3630a_id[] = {
-       { LM3630A_NAME },
-       {}
+       { .name = LM3630A_NAME },
+       { }
 };
 
 MODULE_DEVICE_TABLE(i2c, lm3630a_id);
index 37ccc631c49818c294912ff698e15d55d9a1ecda..ea748b80b737989c3641504b405b795ea339c92a 100644 (file)
@@ -403,8 +403,8 @@ static void lm3639_remove(struct i2c_client *client)
 }
 
 static const struct i2c_device_id lm3639_id[] = {
-       { LM3639_NAME },
-       {}
+       { .name = LM3639_NAME },
+       { }
 };
 
 MODULE_DEVICE_TABLE(i2c, lm3639_id);
index d191560ce285f918b61bd0c5e7493967a9291963..43a2123d3a4dc51b0ced915bceee69e9f57a1ef6 100644 (file)
@@ -570,13 +570,13 @@ static const struct of_device_id lp855x_dt_ids[] __maybe_unused = {
 MODULE_DEVICE_TABLE(of, lp855x_dt_ids);
 
 static const struct i2c_device_id lp855x_ids[] = {
-       {"lp8550", LP8550},
-       {"lp8551", LP8551},
-       {"lp8552", LP8552},
-       {"lp8553", LP8553},
-       {"lp8555", LP8555},
-       {"lp8556", LP8556},
-       {"lp8557", LP8557},
+       { .name = "lp8550", .driver_data = LP8550 },
+       { .name = "lp8551", .driver_data = LP8551 },
+       { .name = "lp8552", .driver_data = LP8552 },
+       { .name = "lp8553", .driver_data = LP8553 },
+       { .name = "lp8555", .driver_data = LP8555 },
+       { .name = "lp8556", .driver_data = LP8556 },
+       { .name = "lp8557", .driver_data = LP8557 },
        { }
 };
 MODULE_DEVICE_TABLE(i2c, lp855x_ids);
index a205f004eab24dea0d1284d6fe03790378c34c5e..e643ab9c3536c5eca5934b3b3448f7ac3632aa3a 100644 (file)
@@ -131,7 +131,7 @@ static void lv5207lp_remove(struct i2c_client *client)
 }
 
 static const struct i2c_device_id lv5207lp_ids[] = {
-       { "lv5207lp" },
+       { .name = "lv5207lp" },
        { }
 };
 MODULE_DEVICE_TABLE(i2c, lv5207lp_ids);
index 9337110ce6e593b34334ea875b2d23d52f9f0d50..413cfe27dfd9dfeaa7249394f13caf1b4e9d5685 100644 (file)
@@ -400,7 +400,7 @@ static const struct of_device_id mp3309c_match_table[] = {
 MODULE_DEVICE_TABLE(of, mp3309c_match_table);
 
 static const struct i2c_device_id mp3309c_id[] = {
-       { "mp3309c" },
+       { .name = "mp3309c" },
        { }
 };
 MODULE_DEVICE_TABLE(i2c, mp3309c_id);