* [PATCH net-next] nfc: Use named initializers for struct i2c_device_id
@ 2026-05-18 13:33 Uwe Kleine-König (The Capable Hub)
2026-05-18 15:09 ` Krzysztof Kozlowski
0 siblings, 1 reply; 2+ messages in thread
From: Uwe Kleine-König (The Capable Hub) @ 2026-05-18 13:33 UTC (permalink / raw)
To: netdev
Cc: Krzysztof Kozlowski, Simon Horman, Jakub Kicinski,
Andy Shevchenko, Ian Ray, Carl Lee, Tomasz Unger, linux-kernel
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.
While touching all these arrays, unify usage of whitespace in 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) <u.kleine-koenig@baylibre.com>
---
Hello,
this patch is part of a bigger quest to use named initializers for
mainly struct i2c_device_id::driver_data to be able to modify
i2c_device_id. See e.g.
https://lore.kernel.org/all/20260518111203.639603-2-u.kleine-koenig@baylibre.com/
for the details.
This patch here isn't critical for this quest, as no driver makes use of
.driver_data, so apart from the better readability this is only about
consistency with other subsystems.
According to MAINTAINERS the nfc subsystem is orphaned, so I hope
someone feels responsible to pick up this patch.
Best regards
Uwe
drivers/nfc/microread/i2c.c | 2 +-
drivers/nfc/nfcmrvl/i2c.c | 4 ++--
drivers/nfc/nxp-nci/i2c.c | 4 ++--
drivers/nfc/pn533/i2c.c | 4 ++--
drivers/nfc/pn544/i2c.c | 4 ++--
drivers/nfc/s3fwrn5/i2c.c | 4 ++--
drivers/nfc/st-nci/i2c.c | 4 ++--
drivers/nfc/st21nfca/i2c.c | 4 ++--
8 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/drivers/nfc/microread/i2c.c b/drivers/nfc/microread/i2c.c
index f00cff7f9693..f45e883b8730 100644
--- a/drivers/nfc/microread/i2c.c
+++ b/drivers/nfc/microread/i2c.c
@@ -276,7 +276,7 @@ static void microread_i2c_remove(struct i2c_client *client)
}
static const struct i2c_device_id microread_i2c_id[] = {
- { MICROREAD_I2C_DRIVER_NAME },
+ { .name = MICROREAD_I2C_DRIVER_NAME },
{ }
};
MODULE_DEVICE_TABLE(i2c, microread_i2c_id);
diff --git a/drivers/nfc/nfcmrvl/i2c.c b/drivers/nfc/nfcmrvl/i2c.c
index 39ecf2aeda80..66877a7d03f2 100644
--- a/drivers/nfc/nfcmrvl/i2c.c
+++ b/drivers/nfc/nfcmrvl/i2c.c
@@ -252,8 +252,8 @@ static const struct of_device_id of_nfcmrvl_i2c_match[] __maybe_unused = {
MODULE_DEVICE_TABLE(of, of_nfcmrvl_i2c_match);
static const struct i2c_device_id nfcmrvl_i2c_id_table[] = {
- { "nfcmrvl_i2c" },
- {}
+ { .name = "nfcmrvl_i2c" },
+ { }
};
MODULE_DEVICE_TABLE(i2c, nfcmrvl_i2c_id_table);
diff --git a/drivers/nfc/nxp-nci/i2c.c b/drivers/nfc/nxp-nci/i2c.c
index b3d34433bd14..19b019e3557f 100644
--- a/drivers/nfc/nxp-nci/i2c.c
+++ b/drivers/nfc/nxp-nci/i2c.c
@@ -322,8 +322,8 @@ static void nxp_nci_i2c_remove(struct i2c_client *client)
}
static const struct i2c_device_id nxp_nci_i2c_id_table[] = {
- { "nxp-nci_i2c" },
- {}
+ { .name = "nxp-nci_i2c" },
+ { }
};
MODULE_DEVICE_TABLE(i2c, nxp_nci_i2c_id_table);
diff --git a/drivers/nfc/pn533/i2c.c b/drivers/nfc/pn533/i2c.c
index 132c050a365d..94aca9119f0f 100644
--- a/drivers/nfc/pn533/i2c.c
+++ b/drivers/nfc/pn533/i2c.c
@@ -249,8 +249,8 @@ static const struct of_device_id of_pn533_i2c_match[] __maybe_unused = {
MODULE_DEVICE_TABLE(of, of_pn533_i2c_match);
static const struct i2c_device_id pn533_i2c_id_table[] = {
- { PN533_I2C_DRIVER_NAME },
- {}
+ { .name = PN533_I2C_DRIVER_NAME },
+ { }
};
MODULE_DEVICE_TABLE(i2c, pn533_i2c_id_table);
diff --git a/drivers/nfc/pn544/i2c.c b/drivers/nfc/pn544/i2c.c
index b31b5bef7187..dcfa96bd4345 100644
--- a/drivers/nfc/pn544/i2c.c
+++ b/drivers/nfc/pn544/i2c.c
@@ -44,8 +44,8 @@
PN544_HCI_I2C_LLC_MAX_PAYLOAD)
static const struct i2c_device_id pn544_hci_i2c_id_table[] = {
- { "pn544" },
- {}
+ { .name = "pn544" },
+ { }
};
MODULE_DEVICE_TABLE(i2c, pn544_hci_i2c_id_table);
diff --git a/drivers/nfc/s3fwrn5/i2c.c b/drivers/nfc/s3fwrn5/i2c.c
index 91b8d1445efd..e9a34d27a369 100644
--- a/drivers/nfc/s3fwrn5/i2c.c
+++ b/drivers/nfc/s3fwrn5/i2c.c
@@ -205,8 +205,8 @@ static void s3fwrn5_i2c_remove(struct i2c_client *client)
}
static const struct i2c_device_id s3fwrn5_i2c_id_table[] = {
- { S3FWRN5_I2C_DRIVER_NAME },
- {}
+ { .name = S3FWRN5_I2C_DRIVER_NAME },
+ { }
};
MODULE_DEVICE_TABLE(i2c, s3fwrn5_i2c_id_table);
diff --git a/drivers/nfc/st-nci/i2c.c b/drivers/nfc/st-nci/i2c.c
index 416770adbeba..9ae839a6f5cc 100644
--- a/drivers/nfc/st-nci/i2c.c
+++ b/drivers/nfc/st-nci/i2c.c
@@ -257,8 +257,8 @@ static void st_nci_i2c_remove(struct i2c_client *client)
}
static const struct i2c_device_id st_nci_i2c_id_table[] = {
- { ST_NCI_DRIVER_NAME },
- {}
+ { .name = ST_NCI_DRIVER_NAME },
+ { }
};
MODULE_DEVICE_TABLE(i2c, st_nci_i2c_id_table);
diff --git a/drivers/nfc/st21nfca/i2c.c b/drivers/nfc/st21nfca/i2c.c
index 6d7861383806..aa5f4922b6b0 100644
--- a/drivers/nfc/st21nfca/i2c.c
+++ b/drivers/nfc/st21nfca/i2c.c
@@ -572,8 +572,8 @@ static void st21nfca_hci_i2c_remove(struct i2c_client *client)
}
static const struct i2c_device_id st21nfca_hci_i2c_id_table[] = {
- { ST21NFCA_HCI_DRIVER_NAME },
- {}
+ { .name = ST21NFCA_HCI_DRIVER_NAME },
+ { }
};
MODULE_DEVICE_TABLE(i2c, st21nfca_hci_i2c_id_table);
base-commit: 254f49634ee16a731174d2ae34bc50bd5f45e731
--
2.47.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] nfc: Use named initializers for struct i2c_device_id
2026-05-18 13:33 [PATCH net-next] nfc: Use named initializers for struct i2c_device_id Uwe Kleine-König (The Capable Hub)
@ 2026-05-18 15:09 ` Krzysztof Kozlowski
0 siblings, 0 replies; 2+ messages in thread
From: Krzysztof Kozlowski @ 2026-05-18 15:09 UTC (permalink / raw)
To: Uwe Kleine-König (The Capable Hub), netdev, David Heidelberg
Cc: Simon Horman, Jakub Kicinski, Andy Shevchenko, Ian Ray, Carl Lee,
Tomasz Unger, linux-kernel
On 18/05/2026 15:33, 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.
>
> While touching all these arrays, unify usage of whitespace in 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) <u.kleine-koenig@baylibre.com>
You need to refresh your tree to next - you miss David.
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-05-18 15:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-18 13:33 [PATCH net-next] nfc: Use named initializers for struct i2c_device_id Uwe Kleine-König (The Capable Hub)
2026-05-18 15:09 ` Krzysztof Kozlowski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox