[PATCH v1] clk: Use named initializers for platform_device_id arrays

Uwe Kleine-König (The Capable Hub) posted 1 patch 1 week, 4 days ago
drivers/clk/clk-bd718x7.c      | 12 ++++++------
drivers/clk/clk-max77686.c     |  8 ++++----
drivers/clk/clk-s2mps11.c      | 12 ++++++------
drivers/clk/samsung/clk-acpm.c |  4 ++--
4 files changed, 18 insertions(+), 18 deletions(-)
[PATCH v1] clk: Use named initializers for platform_device_id arrays
Posted by Uwe Kleine-König (The Capable Hub) 1 week, 4 days ago
Named initializers are better readable and more robust to changes of the
struct definition. This robustness is relevant for a planned change to
struct platform_device_id replacing .driver_data by an anonymous union.

While touching these arrays unify spacing and usage of commas.

Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
---
Hello,

see e.g.
https://lore.kernel.org/all/cover.1779893336.git.u.kleine-koenig@baylibre.com/
for details about my quest to modify platform_device_id.

Best regards
Uwe

 drivers/clk/clk-bd718x7.c      | 12 ++++++------
 drivers/clk/clk-max77686.c     |  8 ++++----
 drivers/clk/clk-s2mps11.c      | 12 ++++++------
 drivers/clk/samsung/clk-acpm.c |  4 ++--
 4 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/drivers/clk/clk-bd718x7.c b/drivers/clk/clk-bd718x7.c
index 1cae974e6d1d..8ddb50c67757 100644
--- a/drivers/clk/clk-bd718x7.c
+++ b/drivers/clk/clk-bd718x7.c
@@ -147,12 +147,12 @@ static int bd71837_clk_probe(struct platform_device *pdev)
 }
 
 static const struct platform_device_id bd718x7_clk_id[] = {
-	{ "bd71837-clk", ROHM_CHIP_TYPE_BD71837 },
-	{ "bd71847-clk", ROHM_CHIP_TYPE_BD71847 },
-	{ "bd71828-clk", ROHM_CHIP_TYPE_BD71828 },
-	{ "bd71815-clk", ROHM_CHIP_TYPE_BD71815 },
-	{ "bd72720-clk", ROHM_CHIP_TYPE_BD72720 },
-	{ },
+	{ .name = "bd71837-clk", .driver_data = ROHM_CHIP_TYPE_BD71837 },
+	{ .name = "bd71847-clk", .driver_data = ROHM_CHIP_TYPE_BD71847 },
+	{ .name = "bd71828-clk", .driver_data = ROHM_CHIP_TYPE_BD71828 },
+	{ .name = "bd71815-clk", .driver_data = ROHM_CHIP_TYPE_BD71815 },
+	{ .name = "bd72720-clk", .driver_data = ROHM_CHIP_TYPE_BD72720 },
+	{ }
 };
 MODULE_DEVICE_TABLE(platform, bd718x7_clk_id);
 
diff --git a/drivers/clk/clk-max77686.c b/drivers/clk/clk-max77686.c
index 9149ce4f702d..e6fde914c5ef 100644
--- a/drivers/clk/clk-max77686.c
+++ b/drivers/clk/clk-max77686.c
@@ -264,10 +264,10 @@ static int max77686_clk_probe(struct platform_device *pdev)
 }
 
 static const struct platform_device_id max77686_clk_id[] = {
-	{ "max77686-clk", .driver_data = CHIP_MAX77686, },
-	{ "max77802-clk", .driver_data = CHIP_MAX77802, },
-	{ "max77620-clock", .driver_data = CHIP_MAX77620, },
-	{},
+	{ .name = "max77686-clk", .driver_data = CHIP_MAX77686 },
+	{ .name = "max77802-clk", .driver_data = CHIP_MAX77802 },
+	{ .name = "max77620-clock", .driver_data = CHIP_MAX77620 },
+	{ }
 };
 MODULE_DEVICE_TABLE(platform, max77686_clk_id);
 
diff --git a/drivers/clk/clk-s2mps11.c b/drivers/clk/clk-s2mps11.c
index ff7ce12a5da6..fa5ac8f673f6 100644
--- a/drivers/clk/clk-s2mps11.c
+++ b/drivers/clk/clk-s2mps11.c
@@ -225,12 +225,12 @@ static void s2mps11_clk_remove(struct platform_device *pdev)
 }
 
 static const struct platform_device_id s2mps11_clk_id[] = {
-	{ "s2mpg10-clk", S2MPG10},
-	{ "s2mps11-clk", S2MPS11X},
-	{ "s2mps13-clk", S2MPS13X},
-	{ "s2mps14-clk", S2MPS14X},
-	{ "s5m8767-clk", S5M8767X},
-	{ },
+	{ .name = "s2mpg10-clk", .driver_data = S2MPG10 },
+	{ .name = "s2mps11-clk", .driver_data = S2MPS11X },
+	{ .name = "s2mps13-clk", .driver_data = S2MPS13X },
+	{ .name = "s2mps14-clk", .driver_data = S2MPS14X },
+	{ .name = "s5m8767-clk", .driver_data = S5M8767X },
+	{ }
 };
 MODULE_DEVICE_TABLE(platform, s2mps11_clk_id);
 
diff --git a/drivers/clk/samsung/clk-acpm.c b/drivers/clk/samsung/clk-acpm.c
index 953ca8d5720a..25cfa953ccac 100644
--- a/drivers/clk/samsung/clk-acpm.c
+++ b/drivers/clk/samsung/clk-acpm.c
@@ -166,8 +166,8 @@ static int acpm_clk_probe(struct platform_device *pdev)
 }
 
 static const struct platform_device_id acpm_clk_id[] = {
-	{ "gs101-acpm-clk" },
-	{}
+	{ .name = "gs101-acpm-clk" },
+	{ }
 };
 MODULE_DEVICE_TABLE(platform, acpm_clk_id);
 

base-commit: e7d700e14934e68f86338c5610cf2ae76798b663
-- 
2.47.3

Re: [PATCH v1] clk: Use named initializers for platform_device_id arrays
Posted by Matti Vaittinen 1 week, 3 days ago
On 28/05/2026 13:29, Uwe Kleine-König (The Capable Hub) wrote:
> Named initializers are better readable and more robust to changes of the
> struct definition. This robustness is relevant for a planned change to
> struct platform_device_id replacing .driver_data by an anonymous union.
> 
> While touching these arrays unify spacing and usage of commas.
> 
> Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com>

-- 
---
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland

~~ When things go utterly wrong vim users can always type :help! ~~
Re: [PATCH v1] clk: Use named initializers for platform_device_id arrays
Posted by Brian Masney 1 week, 3 days ago
On Thu, May 28, 2026 at 12:29:38PM +0200, Uwe Kleine-König (The Capable Hub) wrote:
> Named initializers are better readable and more robust to changes of the
> struct definition. This robustness is relevant for a planned change to
> struct platform_device_id replacing .driver_data by an anonymous union.
> 
> While touching these arrays unify spacing and usage of commas.
> 
> Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>

Reviewed-by: Brian Masney <bmasney@redhat.com>
Re: [PATCH v1] clk: Use named initializers for platform_device_id arrays
Posted by Peter Griffin 1 week, 4 days ago
On Thu, 28 May 2026 at 11:34, Uwe Kleine-König (The Capable Hub)
<u.kleine-koenig@baylibre.com> wrote:
>
> Named initializers are better readable and more robust to changes of the
> struct definition. This robustness is relevant for a planned change to
> struct platform_device_id replacing .driver_data by an anonymous union.
>
> While touching these arrays unify spacing and usage of commas.
>
> Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
> ---

Reviewed-by: Peter Griffin <peter.griffin@linaro.org>
Re: [PATCH v1] clk: Use named initializers for platform_device_id arrays
Posted by Tudor Ambarus 1 week, 4 days ago
Reviewed-by: Tudor Ambarus <tudor.ambarus@linaro.org>