]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
usb: typec: 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:01:42 +0000 (13:01 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 21 May 2026 14:52:31 +0000 (16:52 +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>
Link: https://patch.msgid.link/20260518110142.637215-2-u.kleine-koenig@baylibre.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
14 files changed:
drivers/usb/typec/anx7411.c
drivers/usb/typec/mux/fsa4480.c
drivers/usb/typec/mux/it5205.c
drivers/usb/typec/mux/nb7vpq904m.c
drivers/usb/typec/mux/pi3usb30532.c
drivers/usb/typec/mux/ptn36502.c
drivers/usb/typec/mux/wcd939x-usbss.c
drivers/usb/typec/tcpm/fusb302.c
drivers/usb/typec/tcpm/tcpci.c
drivers/usb/typec/tcpm/tcpci_maxim_core.c
drivers/usb/typec/tcpm/tcpci_rt1711h.c
drivers/usb/typec/tipd/core.c
drivers/usb/typec/ucsi/ucsi_ccg.c
drivers/usb/typec/ucsi/ucsi_stm32g0.c

index 2e8ae1d2faf98f2b2a5c31aafaadc7c35e7f31de..604868ebf4221ffb727bbe9466b49c0580a7beec 100644 (file)
@@ -1577,8 +1577,8 @@ static void anx7411_i2c_remove(struct i2c_client *client)
 }
 
 static const struct i2c_device_id anx7411_id[] = {
-       { "anx7411" },
-       {}
+       { .name = "anx7411" },
+       { }
 };
 
 MODULE_DEVICE_TABLE(i2c, anx7411_id);
index c54e42c7e6a16e1c0c820fd2943abf8749cfdb2b..bea0c1deec94d5a69d2eb9020db95939cdf33e15 100644 (file)
@@ -336,7 +336,7 @@ static void fsa4480_remove(struct i2c_client *client)
 }
 
 static const struct i2c_device_id fsa4480_table[] = {
-       { "fsa4480" },
+       { .name = "fsa4480" },
        { }
 };
 MODULE_DEVICE_TABLE(i2c, fsa4480_table);
index 4357cc67a8672224af8dd0a6b9bcb37e8ced790e..5e1a120b2e3b4dff09f1020fc7fb675075d50a98 100644 (file)
@@ -266,7 +266,7 @@ static void it5205_remove(struct i2c_client *client)
 }
 
 static const struct i2c_device_id it5205_table[] = {
-       { "it5205" },
+       { .name = "it5205" },
        { /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(i2c, it5205_table);
index b57b6c9c40fe78d23f5a2af4e4f4d4b792cbebb8..d1fa26ff442c277470efef3b9cbed16474960a28 100644 (file)
@@ -499,7 +499,7 @@ static void nb7vpq904m_remove(struct i2c_client *client)
 }
 
 static const struct i2c_device_id nb7vpq904m_table[] = {
-       { "nb7vpq904m" },
+       { .name = "nb7vpq904m" },
        { }
 };
 MODULE_DEVICE_TABLE(i2c, nb7vpq904m_table);
index 8eeec135dcdbd0e67982309224341bde6ebedad6..985683fe49e9148633fcdc85cb89568a0146987b 100644 (file)
@@ -169,7 +169,7 @@ static void pi3usb30532_remove(struct i2c_client *client)
 }
 
 static const struct i2c_device_id pi3usb30532_table[] = {
-       { "pi3usb30532" },
+       { .name = "pi3usb30532" },
        { }
 };
 MODULE_DEVICE_TABLE(i2c, pi3usb30532_table);
index 129d9d24b9323aec774060e90685c006dd76ce49..afd16775dbafa9e73fa3b9ff9f2db303ce270474 100644 (file)
@@ -404,7 +404,7 @@ static void ptn36502_remove(struct i2c_client *client)
 }
 
 static const struct i2c_device_id ptn36502_table[] = {
-       { "ptn36502" },
+       { .name = "ptn36502" },
        { }
 };
 MODULE_DEVICE_TABLE(i2c, ptn36502_table);
index d46c353dfaf2f49faabade2d04896cde49c3e5c9..73db3aa3cec4e6bc24da18bab0b9c89d45d94283 100644 (file)
@@ -753,7 +753,7 @@ static void wcd939x_usbss_remove(struct i2c_client *client)
 }
 
 static const struct i2c_device_id wcd939x_usbss_table[] = {
-       { "wcd9390-usbss" },
+       { .name = "wcd9390-usbss" },
        { }
 };
 MODULE_DEVICE_TABLE(i2c, wcd939x_usbss_table);
index 889c4c29c1b806c74e1cfd54e0a5bc413a31a778..6560da0c523b0c75add350981ad8466e49b1e6ba 100644 (file)
@@ -1841,8 +1841,8 @@ static const struct of_device_id fusb302_dt_match[] __maybe_unused = {
 MODULE_DEVICE_TABLE(of, fusb302_dt_match);
 
 static const struct i2c_device_id fusb302_i2c_device_id[] = {
-       { "typec_fusb302" },
-       {}
+       { .name = "typec_fusb302" },
+       { }
 };
 MODULE_DEVICE_TABLE(i2c, fusb302_i2c_device_id);
 
index 24c87dfa6b64f837050120aeee145357eaf209f4..7ac7000b2d1392e71eb52b370b367e5437e9dd83 100644 (file)
@@ -1017,7 +1017,7 @@ static int tcpci_resume(struct device *dev)
 static DEFINE_SIMPLE_DEV_PM_OPS(tcpci_pm_ops, tcpci_suspend, tcpci_resume);
 
 static const struct i2c_device_id tcpci_id[] = {
-       { "tcpci" },
+       { .name = "tcpci" },
        { }
 };
 MODULE_DEVICE_TABLE(i2c, tcpci_id);
index c0ee7e6959edf9666e499a6fa085fbca9f2b07f3..6ceb25e5bdd0b61deba40f0243419b3434563ba4 100644 (file)
@@ -570,7 +570,7 @@ static int max_tcpci_suspend(struct device *dev)
 static SIMPLE_DEV_PM_OPS(max_tcpci_pm_ops, max_tcpci_suspend, max_tcpci_resume);
 
 static const struct i2c_device_id max_tcpci_id[] = {
-       { "maxtcpc" },
+       { .name = "maxtcpc" },
        { }
 };
 MODULE_DEVICE_TABLE(i2c, max_tcpci_id);
index 4b3e4e22a82e803d9f63e8c73904c885fbf03177..a8726da6fc713c3881762cf463b8e0877cfbdd37 100644 (file)
@@ -373,10 +373,10 @@ static const struct rt1711h_chip_info rt1715 = {
 };
 
 static const struct i2c_device_id rt1711h_id[] = {
-       { "et7304", (kernel_ulong_t)&rt1715 },
-       { "rt1711h", (kernel_ulong_t)&rt1711h },
-       { "rt1715", (kernel_ulong_t)&rt1715 },
-       {}
+       { .name = "et7304", .driver_data = (kernel_ulong_t)&rt1715 },
+       { .name = "rt1711h", .driver_data = (kernel_ulong_t)&rt1711h },
+       { .name = "rt1715", .driver_data = (kernel_ulong_t)&rt1715 },
+       { }
 };
 MODULE_DEVICE_TABLE(i2c, rt1711h_id);
 
index 43faec794b95a0fb3660a275ce17038afec79ea9..f560606c588c9d0bfb449c973441676104909366 100644 (file)
@@ -2027,7 +2027,7 @@ static const struct of_device_id tps6598x_of_match[] = {
 MODULE_DEVICE_TABLE(of, tps6598x_of_match);
 
 static const struct i2c_device_id tps6598x_id[] = {
-       { "tps6598x", (kernel_ulong_t)&tps6598x_data },
+       { .name = "tps6598x", .driver_data = (kernel_ulong_t)&tps6598x_data },
        { }
 };
 MODULE_DEVICE_TABLE(i2c, tps6598x_id);
index 199799b319c2a8a46a8d55e18b3c8da3e5da6c2b..ddde0a7702f079e1510b7b991e646bf57698a138 100644 (file)
@@ -1525,8 +1525,8 @@ static const struct of_device_id ucsi_ccg_of_match_table[] = {
 MODULE_DEVICE_TABLE(of, ucsi_ccg_of_match_table);
 
 static const struct i2c_device_id ucsi_ccg_device_id[] = {
-       { "ccgx-ucsi" },
-       {}
+       { .name = "ccgx-ucsi" },
+       { }
 };
 MODULE_DEVICE_TABLE(i2c, ucsi_ccg_device_id);
 
index 838ac0185082c393660b57cca523047bea41fe28..848ed459a6deb0d554bdd7815fd48e34f148c7ff 100644 (file)
@@ -737,8 +737,8 @@ static const struct of_device_id __maybe_unused ucsi_stm32g0_typec_of_match[] =
 MODULE_DEVICE_TABLE(of, ucsi_stm32g0_typec_of_match);
 
 static const struct i2c_device_id ucsi_stm32g0_typec_i2c_devid[] = {
-       { "stm32g0-typec" },
-       {}
+       { .name = "stm32g0-typec" },
+       { }
 };
 MODULE_DEVICE_TABLE(i2c, ucsi_stm32g0_typec_i2c_devid);