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>
}
static const struct i2c_device_id anx7411_id[] = {
- { "anx7411" },
- {}
+ { .name = "anx7411" },
+ { }
};
MODULE_DEVICE_TABLE(i2c, anx7411_id);
}
static const struct i2c_device_id fsa4480_table[] = {
- { "fsa4480" },
+ { .name = "fsa4480" },
{ }
};
MODULE_DEVICE_TABLE(i2c, fsa4480_table);
}
static const struct i2c_device_id it5205_table[] = {
- { "it5205" },
+ { .name = "it5205" },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(i2c, it5205_table);
}
static const struct i2c_device_id nb7vpq904m_table[] = {
- { "nb7vpq904m" },
+ { .name = "nb7vpq904m" },
{ }
};
MODULE_DEVICE_TABLE(i2c, nb7vpq904m_table);
}
static const struct i2c_device_id pi3usb30532_table[] = {
- { "pi3usb30532" },
+ { .name = "pi3usb30532" },
{ }
};
MODULE_DEVICE_TABLE(i2c, pi3usb30532_table);
}
static const struct i2c_device_id ptn36502_table[] = {
- { "ptn36502" },
+ { .name = "ptn36502" },
{ }
};
MODULE_DEVICE_TABLE(i2c, ptn36502_table);
}
static const struct i2c_device_id wcd939x_usbss_table[] = {
- { "wcd9390-usbss" },
+ { .name = "wcd9390-usbss" },
{ }
};
MODULE_DEVICE_TABLE(i2c, wcd939x_usbss_table);
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);
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);
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);
};
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);
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);
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);
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);