[PATCH v5 13/17] mfd: Use named initializers for platform_device_id array
From: Uwe Kleine-König
Date: Mon Nov 23 2026 - 06:19:59 EST
From: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@xxxxxxxxxxxx>
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
platform_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.
Also drop a tailing comma after a list terminator to match the common
style for these device-id arrays.
Reviewed-by: Linus Walleij <linusw@xxxxxxxxxx>
Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@xxxxxxxxxxxx>
---
drivers/mfd/ab8500-core.c | 8 ++++----
drivers/mfd/cros_ec_dev.c | 2 +-
drivers/mfd/mt6397-core.c | 4 ++--
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c
index 766b0eb73e43..ed7e6a99b444 100644
--- a/drivers/mfd/ab8500-core.c
+++ b/drivers/mfd/ab8500-core.c
@@ -1249,10 +1249,10 @@ static int ab8500_probe(struct platform_device *pdev)
}
static const struct platform_device_id ab8500_id[] = {
- { "ab8500-core", AB8500_VERSION_AB8500 },
- { "ab8505-core", AB8500_VERSION_AB8505 },
- { "ab9540-i2c", AB8500_VERSION_AB9540 },
- { "ab8540-i2c", AB8500_VERSION_AB8540 },
+ { .name = "ab8500-core", .driver_data = AB8500_VERSION_AB8500 },
+ { .name = "ab8505-core", .driver_data = AB8500_VERSION_AB8505 },
+ { .name = "ab9540-i2c", .driver_data = AB8500_VERSION_AB9540 },
+ { .name = "ab8540-i2c", .driver_data = AB8500_VERSION_AB8540 },
{ }
};
diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c
index 96aac158fd8b..3c7e7f1efd0f 100644
--- a/drivers/mfd/cros_ec_dev.c
+++ b/drivers/mfd/cros_ec_dev.c
@@ -379,7 +379,7 @@ static void ec_device_remove(struct platform_device *pdev)
}
static const struct platform_device_id cros_ec_id[] = {
- { DRV_NAME },
+ { .name = DRV_NAME },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(platform, cros_ec_id);
diff --git a/drivers/mfd/mt6397-core.c b/drivers/mfd/mt6397-core.c
index 816ddfe1584a..9bc146bcbe0c 100644
--- a/drivers/mfd/mt6397-core.c
+++ b/drivers/mfd/mt6397-core.c
@@ -327,8 +327,8 @@ static const struct of_device_id mt6397_of_match[] = {
MODULE_DEVICE_TABLE(of, mt6397_of_match);
static const struct platform_device_id mt6397_id[] = {
- { "mt6397" },
- { },
+ { .name = "mt6397" },
+ { }
};
MODULE_DEVICE_TABLE(platform, mt6397_id);
--
2.47.3