[PATCH v1 10/12] nfc: Initialize spi_device_idarrays using member names
From: Uwe Kleine-König (The Capable Hub)
Date: Fri Jul 03 2026 - 11:50:00 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.
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/nfc/nfcmrvl/spi.c | 2 +-
drivers/nfc/st-nci/spi.c | 4 ++--
drivers/nfc/st95hf/core.c | 2 +-
drivers/nfc/trf7970a.c | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/nfc/nfcmrvl/spi.c b/drivers/nfc/nfcmrvl/spi.c
index f873f5380017..bc5140c194b6 100644
--- a/drivers/nfc/nfcmrvl/spi.c
+++ b/drivers/nfc/nfcmrvl/spi.c
@@ -188,7 +188,7 @@ static const struct of_device_id of_nfcmrvl_spi_match[] = {
MODULE_DEVICE_TABLE(of, of_nfcmrvl_spi_match);
static const struct spi_device_id nfcmrvl_spi_id_table[] = {
- { "nfcmrvl_spi" },
+ { .name = "nfcmrvl_spi" },
{ }
};
MODULE_DEVICE_TABLE(spi, nfcmrvl_spi_id_table);
diff --git a/drivers/nfc/st-nci/spi.c b/drivers/nfc/st-nci/spi.c
index 1bbda3d0a7dc..1b97b2f3f441 100644
--- a/drivers/nfc/st-nci/spi.c
+++ b/drivers/nfc/st-nci/spi.c
@@ -271,8 +271,8 @@ static void st_nci_spi_remove(struct spi_device *dev)
}
static struct spi_device_id st_nci_spi_id_table[] = {
- { ST_NCI_SPI_DRIVER_NAME },
- { "st21nfcb-spi" },
+ { .name = ST_NCI_SPI_DRIVER_NAME },
+ { .name = "st21nfcb-spi" },
{}
};
MODULE_DEVICE_TABLE(spi, st_nci_spi_id_table);
diff --git a/drivers/nfc/st95hf/core.c b/drivers/nfc/st95hf/core.c
index 52fe81a557a0..d4e3049d138a 100644
--- a/drivers/nfc/st95hf/core.c
+++ b/drivers/nfc/st95hf/core.c
@@ -1049,7 +1049,7 @@ static const struct nfc_digital_ops st95hf_nfc_digital_ops = {
};
static const struct spi_device_id st95hf_id[] = {
- { "st95hf" },
+ { .name = "st95hf" },
{}
};
MODULE_DEVICE_TABLE(spi, st95hf_id);
diff --git a/drivers/nfc/trf7970a.c b/drivers/nfc/trf7970a.c
index 8f36ff82be8b..673989d5c927 100644
--- a/drivers/nfc/trf7970a.c
+++ b/drivers/nfc/trf7970a.c
@@ -2310,7 +2310,7 @@ static const struct of_device_id trf7970a_of_match[] = {
MODULE_DEVICE_TABLE(of, trf7970a_of_match);
static const struct spi_device_id trf7970a_id_table[] = {
- { "trf7970a" },
+ { .name = "trf7970a" },
{}
};
--
2.55.0.11.g153666a7d9bb