]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net: pse-pd: Use named initializers for arrays of i2c_device_data
authorUwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
Tue, 19 May 2026 14:01:01 +0000 (16:01 +0200)
committerJakub Kicinski <kuba@kernel.org>
Thu, 21 May 2026 02:01:48 +0000 (19:01 -0700)
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>
Acked-by: Oleksij Rempel <o.rempel@pengutronix.de>
Link: https://patch.msgid.link/20260519140101.1584946-2-u.kleine-koenig@baylibre.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/pse-pd/pd692x0.c
drivers/net/pse-pd/si3474.c
drivers/net/pse-pd/tps23881.c

index 4a3c852780f581f019266402164c9853b22f94e5..49b1527829ad9824e22081469387e5e9d9456703 100644 (file)
@@ -1853,7 +1853,7 @@ static void pd692x0_i2c_remove(struct i2c_client *client)
 }
 
 static const struct i2c_device_id pd692x0_id[] = {
-       { PD692X0_PSE_NAME },
+       { .name = PD692X0_PSE_NAME },
        { }
 };
 MODULE_DEVICE_TABLE(i2c, pd692x0_id);
index aa07ffbce54d7637a408289e4171fc62eaefc095..1845b9c51cf7a212fec4c32be3d4ee483c300223 100644 (file)
@@ -550,8 +550,8 @@ static int si3474_i2c_probe(struct i2c_client *client)
 }
 
 static const struct i2c_device_id si3474_id[] = {
-       { "si3474" },
-       {}
+       { .name = "si3474" },
+       { }
 };
 MODULE_DEVICE_TABLE(i2c, si3474_id);
 
index d40cb35a25478497a82051b3d7e41564381ac3a9..49d6389da067cabfa7a795a6a09ae4602d24d885 100644 (file)
@@ -1528,8 +1528,8 @@ static int tps23881_i2c_probe(struct i2c_client *client)
 }
 
 static const struct i2c_device_id tps23881_id[] = {
-       { "tps23881", .driver_data = (kernel_ulong_t)&tps23881_info[TPS23881] },
-       { "tps23881b", .driver_data = (kernel_ulong_t)&tps23881_info[TPS23881B] },
+       { .name = "tps23881", .driver_data = (kernel_ulong_t)&tps23881_info[TPS23881] },
+       { .name = "tps23881b", .driver_data = (kernel_ulong_t)&tps23881_info[TPS23881B] },
        { }
 };
 MODULE_DEVICE_TABLE(i2c, tps23881_id);