pinctrl: 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) <u.kleine-koenig@baylibre.com>
Signed-off-by: Linus Walleij <linusw@kernel.org>
This commit is contained in:
Uwe Kleine-König (The Capable Hub) 2026-05-17 15:48:35 +02:00 committed by Linus Walleij
parent d798af0a0f
commit 84c0fe4a20
4 changed files with 17 additions and 17 deletions

View File

@ -1033,7 +1033,7 @@ static void aw9523_remove(struct i2c_client *client)
}
static const struct i2c_device_id aw9523_i2c_id_table[] = {
{ "aw9523_i2c" },
{ .name = "aw9523_i2c" },
{ }
};
MODULE_DEVICE_TABLE(i2c, aw9523_i2c_id_table);

View File

@ -1461,9 +1461,9 @@ static int cy8c95x0_probe(struct i2c_client *client)
}
static const struct i2c_device_id cy8c95x0_id[] = {
{ "cy8c9520", 20 },
{ "cy8c9540", 40 },
{ "cy8c9560", 60 },
{ .name = "cy8c9520", .driver_data = 20 },
{ .name = "cy8c9540", .driver_data = 40 },
{ .name = "cy8c9560", .driver_data = 60 },
{ }
};
MODULE_DEVICE_TABLE(i2c, cy8c95x0_id);

View File

@ -67,9 +67,9 @@ static const struct mcp23s08_info mcp23018_i2c = {
};
static const struct i2c_device_id mcp230xx_id[] = {
{ "mcp23008", (kernel_ulong_t)&mcp23008_i2c },
{ "mcp23017", (kernel_ulong_t)&mcp23017_i2c },
{ "mcp23018", (kernel_ulong_t)&mcp23018_i2c },
{ .name = "mcp23008", .driver_data = (kernel_ulong_t)&mcp23008_i2c },
{ .name = "mcp23017", .driver_data = (kernel_ulong_t)&mcp23017_i2c },
{ .name = "mcp23018", .driver_data = (kernel_ulong_t)&mcp23018_i2c },
{ }
};
MODULE_DEVICE_TABLE(i2c, mcp230xx_id);

View File

@ -839,16 +839,16 @@ static const struct pinconf_ops sx150x_pinconf_ops = {
};
static const struct i2c_device_id sx150x_id[] = {
{"sx1501q", (kernel_ulong_t) &sx1501q_device_data },
{"sx1502q", (kernel_ulong_t) &sx1502q_device_data },
{"sx1503q", (kernel_ulong_t) &sx1503q_device_data },
{"sx1504q", (kernel_ulong_t) &sx1504q_device_data },
{"sx1505q", (kernel_ulong_t) &sx1505q_device_data },
{"sx1506q", (kernel_ulong_t) &sx1506q_device_data },
{"sx1507q", (kernel_ulong_t) &sx1507q_device_data },
{"sx1508q", (kernel_ulong_t) &sx1508q_device_data },
{"sx1509q", (kernel_ulong_t) &sx1509q_device_data },
{}
{ .name = "sx1501q", .driver_data = (kernel_ulong_t)&sx1501q_device_data },
{ .name = "sx1502q", .driver_data = (kernel_ulong_t)&sx1502q_device_data },
{ .name = "sx1503q", .driver_data = (kernel_ulong_t)&sx1503q_device_data },
{ .name = "sx1504q", .driver_data = (kernel_ulong_t)&sx1504q_device_data },
{ .name = "sx1505q", .driver_data = (kernel_ulong_t)&sx1505q_device_data },
{ .name = "sx1506q", .driver_data = (kernel_ulong_t)&sx1506q_device_data },
{ .name = "sx1507q", .driver_data = (kernel_ulong_t)&sx1507q_device_data },
{ .name = "sx1508q", .driver_data = (kernel_ulong_t)&sx1508q_device_data },
{ .name = "sx1509q", .driver_data = (kernel_ulong_t)&sx1509q_device_data },
{ }
};
static const struct of_device_id sx150x_of_match[] = {