mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v1 0/2] clk: Use named initializers for platform_device_id arrays
@ 2026-06-17  9:24 Uwe Kleine-König (The Capable Hub)
  2026-06-17  9:24 ` [PATCH v1 1/2] clocksource: sh_mtu2: Drop unused assignment of platform_device_id Uwe Kleine-König (The Capable Hub)
  2026-06-17  9:24 ` [PATCH v1 2/2] clocksource: Use named initializers for platform_device_id arrays Uwe Kleine-König (The Capable Hub)
  0 siblings, 2 replies; 3+ messages in thread
From: Uwe Kleine-König (The Capable Hub) @ 2026-06-17  9:24 UTC (permalink / raw)
  To: Daniel Lezcano, Thomas Gleixner; +Cc: linux-kernel

Hello,

this patch series is a preparation for changing struct
platform_device_id, which requires that .driver_data isn't assigned
using a list expression. But also without that in mind, I consider this
series a nice cleanup as named initialisation is easer to understand for
a human.

See e.g.
https://lore.kernel.org/all/cover.1780048925.git.u.kleine-koenig@baylibre.com/
for details about my plans for platform_device_id.

Best regards
Uwe

Uwe Kleine-König (The Capable Hub) (2):
  clocksource: sh_mtu2: Drop unused assignment of platform_device_id
  clocksource: Use named initializers for platform_device_id arrays

 drivers/clocksource/sh_cmt.c  | 4 ++--
 drivers/clocksource/sh_mtu2.c | 4 ++--
 drivers/clocksource/sh_tmu.c  | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)


base-commit: 4fa3f5fabb30bf00d7475d5a33459ea83d639bf9
-- 
2.47.3


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v1 1/2] clocksource: sh_mtu2: Drop unused assignment of platform_device_id
  2026-06-17  9:24 [PATCH v1 0/2] clk: Use named initializers for platform_device_id arrays Uwe Kleine-König (The Capable Hub)
@ 2026-06-17  9:24 ` Uwe Kleine-König (The Capable Hub)
  2026-06-17  9:24 ` [PATCH v1 2/2] clocksource: Use named initializers for platform_device_id arrays Uwe Kleine-König (The Capable Hub)
  1 sibling, 0 replies; 3+ messages in thread
From: Uwe Kleine-König (The Capable Hub) @ 2026-06-17  9:24 UTC (permalink / raw)
  To: Daniel Lezcano, Thomas Gleixner; +Cc: linux-kernel

The driver explicitly sets the .driver_data member of struct
platform_device_id to zero without relying on that value. Drop these
unused assignments.

While touching this array drop the comma after the list terminator and
use a named initializer for .name.

Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
---
 drivers/clocksource/sh_mtu2.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/clocksource/sh_mtu2.c b/drivers/clocksource/sh_mtu2.c
index 1997639b113e..3aca86d6a2d4 100644
--- a/drivers/clocksource/sh_mtu2.c
+++ b/drivers/clocksource/sh_mtu2.c
@@ -484,8 +484,8 @@ static int sh_mtu2_probe(struct platform_device *pdev)
 }
 
 static const struct platform_device_id sh_mtu2_id_table[] = {
-	{ "sh-mtu2", 0 },
-	{ },
+	{ .name = "sh-mtu2" },
+	{ }
 };
 MODULE_DEVICE_TABLE(platform, sh_mtu2_id_table);
 
-- 
2.47.3


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v1 2/2] clocksource: Use named initializers for platform_device_id arrays
  2026-06-17  9:24 [PATCH v1 0/2] clk: Use named initializers for platform_device_id arrays Uwe Kleine-König (The Capable Hub)
  2026-06-17  9:24 ` [PATCH v1 1/2] clocksource: sh_mtu2: Drop unused assignment of platform_device_id Uwe Kleine-König (The Capable Hub)
@ 2026-06-17  9:24 ` Uwe Kleine-König (The Capable Hub)
  1 sibling, 0 replies; 3+ messages in thread
From: Uwe Kleine-König (The Capable Hub) @ 2026-06-17  9:24 UTC (permalink / raw)
  To: Daniel Lezcano, Thomas Gleixner; +Cc: linux-kernel

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.

Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
---
 drivers/clocksource/sh_cmt.c | 4 ++--
 drivers/clocksource/sh_tmu.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c
index cf057f531a58..7977507f6ce3 100644
--- a/drivers/clocksource/sh_cmt.c
+++ b/drivers/clocksource/sh_cmt.c
@@ -974,8 +974,8 @@ static int sh_cmt_map_memory(struct sh_cmt_device *cmt)
 }
 
 static const struct platform_device_id sh_cmt_id_table[] = {
-	{ "sh-cmt-16", (kernel_ulong_t)&sh_cmt_info[SH_CMT_16BIT] },
-	{ "sh-cmt-32", (kernel_ulong_t)&sh_cmt_info[SH_CMT_32BIT] },
+	{ .name = "sh-cmt-16", .driver_data = (kernel_ulong_t)&sh_cmt_info[SH_CMT_16BIT] },
+	{ .name = "sh-cmt-32", .driver_data = (kernel_ulong_t)&sh_cmt_info[SH_CMT_32BIT] },
 	{ }
 };
 MODULE_DEVICE_TABLE(platform, sh_cmt_id_table);
diff --git a/drivers/clocksource/sh_tmu.c b/drivers/clocksource/sh_tmu.c
index 8d6a9e279f73..8b3cfa6727bd 100644
--- a/drivers/clocksource/sh_tmu.c
+++ b/drivers/clocksource/sh_tmu.c
@@ -614,8 +614,8 @@ static int sh_tmu_probe(struct platform_device *pdev)
 }
 
 static const struct platform_device_id sh_tmu_id_table[] = {
-	{ "sh-tmu", SH_TMU },
-	{ "sh-tmu-sh3", SH_TMU_SH3 },
+	{ .name = "sh-tmu", .driver_data = SH_TMU },
+	{ .name = "sh-tmu-sh3", .driver_data = SH_TMU_SH3 },
 	{ }
 };
 MODULE_DEVICE_TABLE(platform, sh_tmu_id_table);
-- 
2.47.3


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-06-17  9:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-17  9:24 [PATCH v1 0/2] clk: Use named initializers for platform_device_id arrays Uwe Kleine-König (The Capable Hub)
2026-06-17  9:24 ` [PATCH v1 1/2] clocksource: sh_mtu2: Drop unused assignment of platform_device_id Uwe Kleine-König (The Capable Hub)
2026-06-17  9:24 ` [PATCH v1 2/2] clocksource: Use named initializers for platform_device_id arrays Uwe Kleine-König (The Capable Hub)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®