Re: [PATCH v1 03/12] nfc: Initialize acpi_device_id arrays using member names
From: Ian Ray
Date: Tue Jul 07 2026 - 13:13:53 EST
On Fri, Jul 03, 2026 at 05:46:17PM +0200, Uwe Kleine-König (The Capable Hub) wrote:
> 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
> acpi_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. The former was confirmed with x86 and arm64
> builds.
>
> Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@xxxxxxxxxxxx>
Nice clarity improvement.
Reviewed-by: Ian Ray <ian.ray@xxxxxxxxxxxxxxxx>
> ---
> drivers/nfc/fdp/i2c.c | 2 +-
> drivers/nfc/nxp-nci/i2c.c | 6 +++---
> drivers/nfc/pn544/i2c.c | 2 +-
> drivers/nfc/st-nci/i2c.c | 4 ++--
> drivers/nfc/st-nci/spi.c | 2 +-
> drivers/nfc/st21nfca/i2c.c | 2 +-
> 6 files changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/nfc/fdp/i2c.c b/drivers/nfc/fdp/i2c.c
> index 9d589b388432..47f3838ac9d4 100644
> --- a/drivers/nfc/fdp/i2c.c
> +++ b/drivers/nfc/fdp/i2c.c
> @@ -349,7 +349,7 @@ static void fdp_nci_i2c_remove(struct i2c_client *client)
> }
>
> static const struct acpi_device_id fdp_nci_i2c_acpi_match[] = {
> - { "INT339A" },
> + { .id = "INT339A" },
> {}
> };
> MODULE_DEVICE_TABLE(acpi, fdp_nci_i2c_acpi_match);
> diff --git a/drivers/nfc/nxp-nci/i2c.c b/drivers/nfc/nxp-nci/i2c.c
> index faebc89a7ef5..39b43f8f3bf0 100644
> --- a/drivers/nfc/nxp-nci/i2c.c
> +++ b/drivers/nfc/nxp-nci/i2c.c
> @@ -362,9 +362,9 @@ MODULE_DEVICE_TABLE(of, of_nxp_nci_i2c_match);
>
> #ifdef CONFIG_ACPI
> static const struct acpi_device_id acpi_id[] = {
> - { "NXP1001" },
> - { "NXP1002" },
> - { "NXP7471" },
> + { .id = "NXP1001" },
> + { .id = "NXP1002" },
> + { .id = "NXP7471" },
> { }
> };
> MODULE_DEVICE_TABLE(acpi, acpi_id);
> diff --git a/drivers/nfc/pn544/i2c.c b/drivers/nfc/pn544/i2c.c
> index 66d070b18b4d..ccca07eb828c 100644
> --- a/drivers/nfc/pn544/i2c.c
> +++ b/drivers/nfc/pn544/i2c.c
> @@ -51,7 +51,7 @@ static const struct i2c_device_id pn544_hci_i2c_id_table[] = {
> MODULE_DEVICE_TABLE(i2c, pn544_hci_i2c_id_table);
>
> static const struct acpi_device_id pn544_hci_i2c_acpi_match[] = {
> - { "NXP5440" },
> + { .id = "NXP5440" },
> {}
> };
> MODULE_DEVICE_TABLE(acpi, pn544_hci_i2c_acpi_match);
> diff --git a/drivers/nfc/st-nci/i2c.c b/drivers/nfc/st-nci/i2c.c
> index 4ddf0cc2a259..3906a806ec8b 100644
> --- a/drivers/nfc/st-nci/i2c.c
> +++ b/drivers/nfc/st-nci/i2c.c
> @@ -263,8 +263,8 @@ static const struct i2c_device_id st_nci_i2c_id_table[] = {
> MODULE_DEVICE_TABLE(i2c, st_nci_i2c_id_table);
>
> static const struct acpi_device_id st_nci_i2c_acpi_match[] = {
> - {"SMO2101"},
> - {"SMO2102"},
> + { .id = "SMO2101" },
> + { .id = "SMO2102" },
> {}
> };
> MODULE_DEVICE_TABLE(acpi, st_nci_i2c_acpi_match);
> diff --git a/drivers/nfc/st-nci/spi.c b/drivers/nfc/st-nci/spi.c
> index c94d67f33184..8fc60a972d98 100644
> --- a/drivers/nfc/st-nci/spi.c
> +++ b/drivers/nfc/st-nci/spi.c
> @@ -278,7 +278,7 @@ static struct spi_device_id st_nci_spi_id_table[] = {
> MODULE_DEVICE_TABLE(spi, st_nci_spi_id_table);
>
> static const struct acpi_device_id st_nci_spi_acpi_match[] = {
> - { "SMO2101" },
> + { .id = "SMO2101" },
> {}
> };
> MODULE_DEVICE_TABLE(acpi, st_nci_spi_acpi_match);
> diff --git a/drivers/nfc/st21nfca/i2c.c b/drivers/nfc/st21nfca/i2c.c
> index d6cb74a89f93..e5109f701795 100644
> --- a/drivers/nfc/st21nfca/i2c.c
> +++ b/drivers/nfc/st21nfca/i2c.c
> @@ -578,7 +578,7 @@ static const struct i2c_device_id st21nfca_hci_i2c_id_table[] = {
> MODULE_DEVICE_TABLE(i2c, st21nfca_hci_i2c_id_table);
>
> static const struct acpi_device_id st21nfca_hci_i2c_acpi_match[] = {
> - { "SMO2100" },
> + { .id = "SMO2100" },
> {}
> };
> MODULE_DEVICE_TABLE(acpi, st21nfca_hci_i2c_acpi_match);
> --
> 2.55.0.11.g153666a7d9bb
>