From: Uwe Kleine-König (The Capable Hub) Date: Mon, 18 May 2026 11:01:42 +0000 (+0200) Subject: usb: typec: Use named initializers for arrays of i2c_device_data X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=52be520ca9efd41d5fb06b172489c13ceb68dbc0;p=thirdparty%2Flinux.git usb: typec: Use named initializers for arrays of i2c_device_data 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) Link: https://patch.msgid.link/20260518110142.637215-2-u.kleine-koenig@baylibre.com Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/typec/anx7411.c b/drivers/usb/typec/anx7411.c index 2e8ae1d2faf98..604868ebf4221 100644 --- a/drivers/usb/typec/anx7411.c +++ b/drivers/usb/typec/anx7411.c @@ -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); diff --git a/drivers/usb/typec/mux/fsa4480.c b/drivers/usb/typec/mux/fsa4480.c index c54e42c7e6a16..bea0c1deec94d 100644 --- a/drivers/usb/typec/mux/fsa4480.c +++ b/drivers/usb/typec/mux/fsa4480.c @@ -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); diff --git a/drivers/usb/typec/mux/it5205.c b/drivers/usb/typec/mux/it5205.c index 4357cc67a8672..5e1a120b2e3b4 100644 --- a/drivers/usb/typec/mux/it5205.c +++ b/drivers/usb/typec/mux/it5205.c @@ -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); diff --git a/drivers/usb/typec/mux/nb7vpq904m.c b/drivers/usb/typec/mux/nb7vpq904m.c index b57b6c9c40fe7..d1fa26ff442c2 100644 --- a/drivers/usb/typec/mux/nb7vpq904m.c +++ b/drivers/usb/typec/mux/nb7vpq904m.c @@ -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); diff --git a/drivers/usb/typec/mux/pi3usb30532.c b/drivers/usb/typec/mux/pi3usb30532.c index 8eeec135dcdbd..985683fe49e91 100644 --- a/drivers/usb/typec/mux/pi3usb30532.c +++ b/drivers/usb/typec/mux/pi3usb30532.c @@ -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); diff --git a/drivers/usb/typec/mux/ptn36502.c b/drivers/usb/typec/mux/ptn36502.c index 129d9d24b9323..afd16775dbafa 100644 --- a/drivers/usb/typec/mux/ptn36502.c +++ b/drivers/usb/typec/mux/ptn36502.c @@ -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); diff --git a/drivers/usb/typec/mux/wcd939x-usbss.c b/drivers/usb/typec/mux/wcd939x-usbss.c index d46c353dfaf2f..73db3aa3cec4e 100644 --- a/drivers/usb/typec/mux/wcd939x-usbss.c +++ b/drivers/usb/typec/mux/wcd939x-usbss.c @@ -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); diff --git a/drivers/usb/typec/tcpm/fusb302.c b/drivers/usb/typec/tcpm/fusb302.c index 889c4c29c1b80..6560da0c523b0 100644 --- a/drivers/usb/typec/tcpm/fusb302.c +++ b/drivers/usb/typec/tcpm/fusb302.c @@ -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); diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c index 24c87dfa6b64f..7ac7000b2d139 100644 --- a/drivers/usb/typec/tcpm/tcpci.c +++ b/drivers/usb/typec/tcpm/tcpci.c @@ -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); diff --git a/drivers/usb/typec/tcpm/tcpci_maxim_core.c b/drivers/usb/typec/tcpm/tcpci_maxim_core.c index c0ee7e6959edf..6ceb25e5bdd0b 100644 --- a/drivers/usb/typec/tcpm/tcpci_maxim_core.c +++ b/drivers/usb/typec/tcpm/tcpci_maxim_core.c @@ -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); diff --git a/drivers/usb/typec/tcpm/tcpci_rt1711h.c b/drivers/usb/typec/tcpm/tcpci_rt1711h.c index 4b3e4e22a82e8..a8726da6fc713 100644 --- a/drivers/usb/typec/tcpm/tcpci_rt1711h.c +++ b/drivers/usb/typec/tcpm/tcpci_rt1711h.c @@ -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); diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c index 43faec794b95a..f560606c588c9 100644 --- a/drivers/usb/typec/tipd/core.c +++ b/drivers/usb/typec/tipd/core.c @@ -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); diff --git a/drivers/usb/typec/ucsi/ucsi_ccg.c b/drivers/usb/typec/ucsi/ucsi_ccg.c index 199799b319c2a..ddde0a7702f07 100644 --- a/drivers/usb/typec/ucsi/ucsi_ccg.c +++ b/drivers/usb/typec/ucsi/ucsi_ccg.c @@ -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); diff --git a/drivers/usb/typec/ucsi/ucsi_stm32g0.c b/drivers/usb/typec/ucsi/ucsi_stm32g0.c index 838ac0185082c..848ed459a6deb 100644 --- a/drivers/usb/typec/ucsi/ucsi_stm32g0.c +++ b/drivers/usb/typec/ucsi/ucsi_stm32g0.c @@ -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);