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>
Acked-by: Oleksij Rempel <o.rempel@pengutronix.de>
Link: https://patch.msgid.link/20260519140101.1584946-2-u.kleine-koenig@baylibre.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
}
static const struct i2c_device_id pd692x0_id[] = {
- { PD692X0_PSE_NAME },
+ { .name = PD692X0_PSE_NAME },
{ }
};
MODULE_DEVICE_TABLE(i2c, pd692x0_id);
}
static const struct i2c_device_id si3474_id[] = {
- { "si3474" },
- {}
+ { .name = "si3474" },
+ { }
};
MODULE_DEVICE_TABLE(i2c, si3474_id);
}
static const struct i2c_device_id tps23881_id[] = {
- { "tps23881", .driver_data = (kernel_ulong_t)&tps23881_info[TPS23881] },
- { "tps23881b", .driver_data = (kernel_ulong_t)&tps23881_info[TPS23881B] },
+ { .name = "tps23881", .driver_data = (kernel_ulong_t)&tps23881_info[TPS23881] },
+ { .name = "tps23881b", .driver_data = (kernel_ulong_t)&tps23881_info[TPS23881B] },
{ }
};
MODULE_DEVICE_TABLE(i2c, tps23881_id);