From: Uwe Kleine-König (The Capable Hub) Date: Mon, 18 May 2026 17:05:41 +0000 (+0200) Subject: spi: Use named initializers for arrays of i2c_device_data X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=84bfaa6ceed629cbaeaccf03c4b287c719663284;p=thirdparty%2Fkernel%2Flinux.git 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) Link: https://patch.msgid.link/20260518170542.807843-2-u.kleine-koenig@baylibre.com Signed-off-by: Mark Brown --- diff --git a/drivers/spi/spi-sc18is602.c b/drivers/spi/spi-sc18is602.c index 78c558e7228ec..ae534ebd5e873 100644 --- a/drivers/spi/spi-sc18is602.c +++ b/drivers/spi/spi-sc18is602.c @@ -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); diff --git a/drivers/spi/spi-xcomm.c b/drivers/spi/spi-xcomm.c index 130a3d716dd4c..e40ec6ebe4e55 100644 --- a/drivers/spi/spi-xcomm.c +++ b/drivers/spi/spi-xcomm.c @@ -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);