[PATCH v2 06/12] misc: Use named initializers for arrays of spi_device_data
From: Uwe Kleine-König (The Capable Hub)
Date: Fri Jul 17 2026 - 10:54:58 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.
While touching all these arrays, unify usage of whitespace.
This patch doesn't modify the compiled arrays, only their representation
in source form benefits.
Signed-off-by: Uwe Kleine-König <ukleinek@xxxxxxxxxx>
---
drivers/misc/ad525x_dpot-spi.c | 58 +++++++++++++++---------------
drivers/misc/gehc-achc.c | 4 +--
drivers/misc/keba/lan9252.c | 4 +--
drivers/misc/lattice-ecp3-config.c | 4 +--
4 files changed, 35 insertions(+), 35 deletions(-)
diff --git a/drivers/misc/ad525x_dpot-spi.c b/drivers/misc/ad525x_dpot-spi.c
index 263055bda48b..b582a14a3546 100644
--- a/drivers/misc/ad525x_dpot-spi.c
+++ b/drivers/misc/ad525x_dpot-spi.c
@@ -96,35 +96,35 @@ static void ad_dpot_spi_remove(struct spi_device *spi)
}
static const struct spi_device_id ad_dpot_spi_id[] = {
- {"ad5160", AD5160_ID},
- {"ad5161", AD5161_ID},
- {"ad5162", AD5162_ID},
- {"ad5165", AD5165_ID},
- {"ad5200", AD5200_ID},
- {"ad5201", AD5201_ID},
- {"ad5203", AD5203_ID},
- {"ad5204", AD5204_ID},
- {"ad5206", AD5206_ID},
- {"ad5207", AD5207_ID},
- {"ad5231", AD5231_ID},
- {"ad5232", AD5232_ID},
- {"ad5233", AD5233_ID},
- {"ad5235", AD5235_ID},
- {"ad5260", AD5260_ID},
- {"ad5262", AD5262_ID},
- {"ad5263", AD5263_ID},
- {"ad5290", AD5290_ID},
- {"ad5291", AD5291_ID},
- {"ad5292", AD5292_ID},
- {"ad5293", AD5293_ID},
- {"ad7376", AD7376_ID},
- {"ad8400", AD8400_ID},
- {"ad8402", AD8402_ID},
- {"ad8403", AD8403_ID},
- {"adn2850", ADN2850_ID},
- {"ad5270", AD5270_ID},
- {"ad5271", AD5271_ID},
- {}
+ { .name = "ad5160", .driver_data = AD5160_ID },
+ { .name = "ad5161", .driver_data = AD5161_ID },
+ { .name = "ad5162", .driver_data = AD5162_ID },
+ { .name = "ad5165", .driver_data = AD5165_ID },
+ { .name = "ad5200", .driver_data = AD5200_ID },
+ { .name = "ad5201", .driver_data = AD5201_ID },
+ { .name = "ad5203", .driver_data = AD5203_ID },
+ { .name = "ad5204", .driver_data = AD5204_ID },
+ { .name = "ad5206", .driver_data = AD5206_ID },
+ { .name = "ad5207", .driver_data = AD5207_ID },
+ { .name = "ad5231", .driver_data = AD5231_ID },
+ { .name = "ad5232", .driver_data = AD5232_ID },
+ { .name = "ad5233", .driver_data = AD5233_ID },
+ { .name = "ad5235", .driver_data = AD5235_ID },
+ { .name = "ad5260", .driver_data = AD5260_ID },
+ { .name = "ad5262", .driver_data = AD5262_ID },
+ { .name = "ad5263", .driver_data = AD5263_ID },
+ { .name = "ad5290", .driver_data = AD5290_ID },
+ { .name = "ad5291", .driver_data = AD5291_ID },
+ { .name = "ad5292", .driver_data = AD5292_ID },
+ { .name = "ad5293", .driver_data = AD5293_ID },
+ { .name = "ad7376", .driver_data = AD7376_ID },
+ { .name = "ad8400", .driver_data = AD8400_ID },
+ { .name = "ad8402", .driver_data = AD8402_ID },
+ { .name = "ad8403", .driver_data = AD8403_ID },
+ { .name = "adn2850", .driver_data = ADN2850_ID },
+ { .name = "ad5270", .driver_data = AD5270_ID },
+ { .name = "ad5271", .driver_data = AD5271_ID },
+ { }
};
MODULE_DEVICE_TABLE(spi, ad_dpot_spi_id);
diff --git a/drivers/misc/gehc-achc.c b/drivers/misc/gehc-achc.c
index 1abfa6c257de..9792189c0923 100644
--- a/drivers/misc/gehc-achc.c
+++ b/drivers/misc/gehc-achc.c
@@ -538,8 +538,8 @@ static int gehc_achc_probe(struct spi_device *spi)
}
static const struct spi_device_id gehc_achc_id[] = {
- { "ge,achc" },
- { "achc" },
+ { .name = "ge,achc" },
+ { .name = "achc" },
{ }
};
MODULE_DEVICE_TABLE(spi, gehc_achc_id);
diff --git a/drivers/misc/keba/lan9252.c b/drivers/misc/keba/lan9252.c
index fc54afd1d05b..874dd50fac66 100644
--- a/drivers/misc/keba/lan9252.c
+++ b/drivers/misc/keba/lan9252.c
@@ -339,8 +339,8 @@ static int lan9252_probe(struct spi_device *spi)
}
static const struct spi_device_id lan9252_id[] = {
- {"lan9252"},
- {}
+ { .name = "lan9252" },
+ { }
};
MODULE_DEVICE_TABLE(spi, lan9252_id);
diff --git a/drivers/misc/lattice-ecp3-config.c b/drivers/misc/lattice-ecp3-config.c
index 2b93d5660bf2..740b5cf53842 100644
--- a/drivers/misc/lattice-ecp3-config.c
+++ b/drivers/misc/lattice-ecp3-config.c
@@ -219,8 +219,8 @@ static void lattice_ecp3_remove(struct spi_device *spi)
}
static const struct spi_device_id lattice_ecp3_id[] = {
- { "ecp3-17" },
- { "ecp3-35" },
+ { .name = "ecp3-17" },
+ { .name = "ecp3-35" },
{ }
};
MODULE_DEVICE_TABLE(spi, lattice_ecp3_id);
--
2.55.0.11.g153666a7d9bb