]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
pinctrl: Use named initializers for arrays of i2c_device_data
authorUwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
Sun, 17 May 2026 13:48:35 +0000 (15:48 +0200)
committerLinus Walleij <linusw@kernel.org>
Wed, 10 Jun 2026 21:21:19 +0000 (23:21 +0200)
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>
Signed-off-by: Linus Walleij <linusw@kernel.org>
drivers/pinctrl/pinctrl-aw9523.c
drivers/pinctrl/pinctrl-cy8c95x0.c
drivers/pinctrl/pinctrl-mcp23s08_i2c.c
drivers/pinctrl/pinctrl-sx150x.c

index 02a24ac87ea4b915d552e06fcb764d44fcca4e88..bc94003512cf948c51b45faef47f2e63d3c713b1 100644 (file)
@@ -1033,7 +1033,7 @@ static void aw9523_remove(struct i2c_client *client)
 }
 
 static const struct i2c_device_id aw9523_i2c_id_table[] = {
-       { "aw9523_i2c" },
+       { .name = "aw9523_i2c" },
        { }
 };
 MODULE_DEVICE_TABLE(i2c, aw9523_i2c_id_table);
index ace0be5ec6791d6379e5fa5077effd257abae139..093ae7c1dae5e38a3427d0da217099d3ea939fc4 100644 (file)
@@ -1461,9 +1461,9 @@ static int cy8c95x0_probe(struct i2c_client *client)
 }
 
 static const struct i2c_device_id cy8c95x0_id[] = {
-       { "cy8c9520", 20 },
-       { "cy8c9540", 40 },
-       { "cy8c9560", 60 },
+       { .name = "cy8c9520", .driver_data = 20 },
+       { .name = "cy8c9540", .driver_data = 40 },
+       { .name = "cy8c9560", .driver_data = 60 },
        { }
 };
 MODULE_DEVICE_TABLE(i2c, cy8c95x0_id);
index 94e1add6ddd78fb9765c51edc27a1e36cff2251e..f3dffa3c74d3e33515f07814c5d82d68a38c60eb 100644 (file)
@@ -67,9 +67,9 @@ static const struct mcp23s08_info  mcp23018_i2c = {
 };
 
 static const struct i2c_device_id mcp230xx_id[] = {
-       { "mcp23008", (kernel_ulong_t)&mcp23008_i2c },
-       { "mcp23017", (kernel_ulong_t)&mcp23017_i2c },
-       { "mcp23018", (kernel_ulong_t)&mcp23018_i2c },
+       { .name = "mcp23008", .driver_data = (kernel_ulong_t)&mcp23008_i2c },
+       { .name = "mcp23017", .driver_data = (kernel_ulong_t)&mcp23017_i2c },
+       { .name = "mcp23018", .driver_data = (kernel_ulong_t)&mcp23018_i2c },
        { }
 };
 MODULE_DEVICE_TABLE(i2c, mcp230xx_id);
index 1d6760ffe809a22f5aaff5ac5903327ad701d119..b59d913513d590dafe663d98680b2f5ba6e45a6e 100644 (file)
@@ -839,16 +839,16 @@ static const struct pinconf_ops sx150x_pinconf_ops = {
 };
 
 static const struct i2c_device_id sx150x_id[] = {
-       {"sx1501q", (kernel_ulong_t) &sx1501q_device_data },
-       {"sx1502q", (kernel_ulong_t) &sx1502q_device_data },
-       {"sx1503q", (kernel_ulong_t) &sx1503q_device_data },
-       {"sx1504q", (kernel_ulong_t) &sx1504q_device_data },
-       {"sx1505q", (kernel_ulong_t) &sx1505q_device_data },
-       {"sx1506q", (kernel_ulong_t) &sx1506q_device_data },
-       {"sx1507q", (kernel_ulong_t) &sx1507q_device_data },
-       {"sx1508q", (kernel_ulong_t) &sx1508q_device_data },
-       {"sx1509q", (kernel_ulong_t) &sx1509q_device_data },
-       {}
+       { .name = "sx1501q", .driver_data = (kernel_ulong_t)&sx1501q_device_data },
+       { .name = "sx1502q", .driver_data = (kernel_ulong_t)&sx1502q_device_data },
+       { .name = "sx1503q", .driver_data = (kernel_ulong_t)&sx1503q_device_data },
+       { .name = "sx1504q", .driver_data = (kernel_ulong_t)&sx1504q_device_data },
+       { .name = "sx1505q", .driver_data = (kernel_ulong_t)&sx1505q_device_data },
+       { .name = "sx1506q", .driver_data = (kernel_ulong_t)&sx1506q_device_data },
+       { .name = "sx1507q", .driver_data = (kernel_ulong_t)&sx1507q_device_data },
+       { .name = "sx1508q", .driver_data = (kernel_ulong_t)&sx1508q_device_data },
+       { .name = "sx1509q", .driver_data = (kernel_ulong_t)&sx1509q_device_data },
+       { }
 };
 
 static const struct of_device_id sx150x_of_match[] = {