clk: Use named initializers for platform_device_id arrays
cover clk: Use named initializers for platform_device_id arrays
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/[email protected]/
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
Signature · 1 line
2.47.3
PATCH 1/2 clocksource: sh_mtu2: Drop unused assignment of platform_device_id
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.
--- drivers/clocksource/sh_mtu2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clocksource/sh_mtu2.c +2 -2
@@ -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);
Signature · 1 line
2.47.3
PATCH 2/2 clocksource: Use named initializers for platform_device_id arrays
In reply to Uwe Kleine-König (The Capable Hub)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.
--- drivers/clocksource/sh_cmt.c | 4 ++-- drivers/clocksource/sh_tmu.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/clocksource/sh_cmt.c +2 -2
@@ -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);
drivers/clocksource/sh_tmu.c +2 -2
@@ -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);
Signature · 1 line
2.47.3