[PATCH v2 13/21] gpio: Use named initializers for spi_device_id array

From: Uwe Kleine-König (The Capable Hub)

Date: Wed Jul 15 2026 - 13:02:18 EST


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
spi_device_id that replaces .driver_data by an anonymous union (though
none of these drivers uses .driver_data, so this patch isn't strictly
necessary for the plan, but still ok for consistency).

This patch doesn't modify the compiled arrays, only their representation
in source form benefits.

Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@xxxxxxxxxxxx>
---
drivers/gpio/gpio-max3191x.c | 12 ++++++------
drivers/gpio/gpio-max7301.c | 2 +-
drivers/gpio/gpio-pisosr.c | 2 +-
drivers/gpio/gpio-xra1403.c | 2 +-
4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/gpio/gpio-max3191x.c b/drivers/gpio/gpio-max3191x.c
index 6e6504ab740a..b06fecc98633 100644
--- a/drivers/gpio/gpio-max3191x.c
+++ b/drivers/gpio/gpio-max3191x.c
@@ -449,12 +449,12 @@ static const struct of_device_id max3191x_of_id[] = {
MODULE_DEVICE_TABLE(of, max3191x_of_id);

static const struct spi_device_id max3191x_spi_id[] = {
- { "max31910" },
- { "max31911" },
- { "max31912" },
- { "max31913" },
- { "max31953" },
- { "max31963" },
+ { .name = "max31910" },
+ { .name = "max31911" },
+ { .name = "max31912" },
+ { .name = "max31913" },
+ { .name = "max31953" },
+ { .name = "max31963" },
{ }
};
MODULE_DEVICE_TABLE(spi, max3191x_spi_id);
diff --git a/drivers/gpio/gpio-max7301.c b/drivers/gpio/gpio-max7301.c
index c8bf6a9c3de0..9db20c22ba9f 100644
--- a/drivers/gpio/gpio-max7301.c
+++ b/drivers/gpio/gpio-max7301.c
@@ -70,7 +70,7 @@ static void max7301_remove(struct spi_device *spi)
}

static const struct spi_device_id max7301_id[] = {
- { "max7301" },
+ { .name = "max7301" },
{ }
};
MODULE_DEVICE_TABLE(spi, max7301_id);
diff --git a/drivers/gpio/gpio-pisosr.c b/drivers/gpio/gpio-pisosr.c
index 2732ea8c16b7..75a8f3efaf94 100644
--- a/drivers/gpio/gpio-pisosr.c
+++ b/drivers/gpio/gpio-pisosr.c
@@ -150,7 +150,7 @@ static int pisosr_gpio_probe(struct spi_device *spi)
}

static const struct spi_device_id pisosr_gpio_id_table[] = {
- { "pisosr-gpio", },
+ { .name = "pisosr-gpio" },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(spi, pisosr_gpio_id_table);
diff --git a/drivers/gpio/gpio-xra1403.c b/drivers/gpio/gpio-xra1403.c
index fe0fba6ea902..3713475bdb75 100644
--- a/drivers/gpio/gpio-xra1403.c
+++ b/drivers/gpio/gpio-xra1403.c
@@ -185,7 +185,7 @@ static int xra1403_probe(struct spi_device *spi)
}

static const struct spi_device_id xra1403_ids[] = {
- { "xra1403" },
+ { .name = "xra1403" },
{},
};
MODULE_DEVICE_TABLE(spi, xra1403_ids);
--
2.55.0.11.g153666a7d9bb