[PATCH v1 06/12] nfc: Initialize mei_cl_device_idarrays using member names
Uwe Kleine-König (The Capable Hub) <[email protected]> Fri, 3 Jul 2026 17:46:20 +0200
| Newsgroups | dev.linux.lists.oe-linux-nfc,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <cdc9bbac2e0743550970e565f57996c8a833446f.1783091699.git.u.kleine-koenig@baylibre.com> |
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 mei_cl_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) <[email protected]> --- drivers/nfc/microread/mei.c | 10 ++++++---- drivers/nfc/pn544/mei.c | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/drivers/nfc/microread/mei.c b/drivers/nfc/microread/mei.c index c256ae92d6b1..484e3ae0e875 100644 --- a/drivers/nfc/microread/mei.c +++ b/drivers/nfc/microread/mei.c @@ -48,10 +48,12 @@ static void microread_mei_remove(struct mei_cl_device *cldev) } static struct mei_cl_device_id microread_mei_tbl[] = { - { MICROREAD_DRIVER_NAME, MEI_NFC_UUID, MEI_CL_VERSION_ANY}, - - /* required last entry */ - { } + { + .name = MICROREAD_DRIVER_NAME, + .uuid = MEI_NFC_UUID, + .version = MEI_CL_VERSION_ANY, + }, + { /* required last entry */ } }; MODULE_DEVICE_TABLE(mei, microread_mei_tbl); diff --git a/drivers/nfc/pn544/mei.c b/drivers/nfc/pn544/mei.c index 3d3755cfa71e..7ca117186d3e 100644 --- a/drivers/nfc/pn544/mei.c +++ b/drivers/nfc/pn544/mei.c @@ -47,10 +47,12 @@ static void pn544_mei_remove(struct mei_cl_device *cldev) } static struct mei_cl_device_id pn544_mei_tbl[] = { - { PN544_DRIVER_NAME, MEI_NFC_UUID, MEI_CL_VERSION_ANY}, - - /* required last entry */ - { } + { + .name = PN544_DRIVER_NAME, + .uuid = MEI_NFC_UUID, + .version = MEI_CL_VERSION_ANY, + }, + { /* required last entry */ } }; MODULE_DEVICE_TABLE(mei, pn544_mei_tbl); -- 2.55.0.11.g153666a7d9bb