mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-22 01:08:13 -04:00
spi: 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 these arrays, drop a comma after 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/20260518170542.807843-2-u.kleine-koenig@baylibre.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
committed by
Mark Brown
parent
ae14c160f4
commit
84bfaa6cee
@@ -295,9 +295,9 @@ static int sc18is602_probe(struct i2c_client *client)
|
||||
}
|
||||
|
||||
static const struct i2c_device_id sc18is602_id[] = {
|
||||
{ "sc18is602", sc18is602 },
|
||||
{ "sc18is602b", sc18is602b },
|
||||
{ "sc18is603", sc18is603 },
|
||||
{ .name = "sc18is602", .driver_data = sc18is602 },
|
||||
{ .name = "sc18is602b", .driver_data = sc18is602b },
|
||||
{ .name = "sc18is603", .driver_data = sc18is603 },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(i2c, sc18is602_id);
|
||||
|
||||
@@ -269,8 +269,8 @@ static int spi_xcomm_probe(struct i2c_client *i2c)
|
||||
}
|
||||
|
||||
static const struct i2c_device_id spi_xcomm_ids[] = {
|
||||
{ "spi-xcomm" },
|
||||
{ },
|
||||
{ .name = "spi-xcomm" },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(i2c, spi_xcomm_ids);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user