]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net: dsa: Use named initializers for struct i2c_device_id
authorUwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
Tue, 19 May 2026 14:57:22 +0000 (16:57 +0200)
committerJakub Kicinski <kuba@kernel.org>
Thu, 21 May 2026 02:01:25 +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.

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

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

Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://patch.msgid.link/20260519145722.1590298-2-u.kleine-koenig@baylibre.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/dsa/lan9303_i2c.c
drivers/net/dsa/microchip/ksz9477_i2c.c
drivers/net/dsa/xrs700x/xrs700x_i2c.c

index c62d27cdc117db0219e5ad0677183b423e73c6e9..3a09f3907f4414136673716bd47c315f9ba310f1 100644 (file)
@@ -89,7 +89,7 @@ static void lan9303_i2c_shutdown(struct i2c_client *client)
 /*-------------------------------------------------------------------------*/
 
 static const struct i2c_device_id lan9303_i2c_id[] = {
-       { "lan9303" },
+       { .name = "lan9303" },
        { /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(i2c, lan9303_i2c_id);
index 8e9d08f2e1d659c3cd444d0314118a4dd17111a1..ec0c9cab3defe3181229864d9235b8a04e9f1b0e 100644 (file)
@@ -80,8 +80,8 @@ static void ksz9477_i2c_shutdown(struct i2c_client *i2c)
 }
 
 static const struct i2c_device_id ksz9477_i2c_id[] = {
-       { "ksz9477-switch" },
-       {}
+       { .name = "ksz9477-switch" },
+       { }
 };
 
 MODULE_DEVICE_TABLE(i2c, ksz9477_i2c_id);
index 9b731dea78c14989dfae818dd7953d5d1ff06c57..e6a7839c4a04d589e1ed7da3bd2ff9452fdc7e52 100644 (file)
@@ -127,8 +127,8 @@ static void xrs700x_i2c_shutdown(struct i2c_client *i2c)
 }
 
 static const struct i2c_device_id xrs700x_i2c_id[] = {
-       { "xrs700x-switch" },
-       {}
+       { .name = "xrs700x-switch" },
+       { }
 };
 
 MODULE_DEVICE_TABLE(i2c, xrs700x_i2c_id);