Skip to contentSkip to conversation

extcon: max14577: Use named initializers for the platform_device_id array

PATCH Applied Uwe Kleine-König (The Capable Hub) 3 participants 5 messages Jun 16 – Nov 27

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 extcon: max14577: Use named initializers for the platform_device_id array

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 this array drop commas before closing curly braces on the same line.

---
 drivers/extcon/extcon-max14577.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/extcon/extcon-max14577.c +2 -2
index 5476f48ed74b..2c1580ebfc61 100644
@@ -771,8 +771,8 @@ static int max14577_muic_probe(struct platform_device *pdev)
 }
 
 static const struct platform_device_id max14577_muic_id[] = {
-	{ "max14577-muic", MAXIM_DEVICE_TYPE_MAX14577, },
-	{ "max77836-muic", MAXIM_DEVICE_TYPE_MAX77836, },
+	{ .name = "max14577-muic", .driver_data = MAXIM_DEVICE_TYPE_MAX14577 },
+	{ .name = "max77836-muic", .driver_data = MAXIM_DEVICE_TYPE_MAX77836 },
 	{ }
 };
 MODULE_DEVICE_TABLE(platform, max14577_muic_id);

base-commit: 8d6dbbbe3ba62de0a63e962ee004afb848c8e3ac

Signature · 1 line
2.47.3
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · 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.

While touching this array drop commas before closing curly braces on the same line.

---
 drivers/extcon/extcon-max14577.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Best regards,
Krzysztof

#2 lore raw
In reply to Uwe Kleine-König (The Capable Hub)

Hello,

Quoted 8 lines · 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.

While touching this array drop commas before closing curly braces on the same line.

this patch got a review but wasn't picked up yet. Is this still on your radar?

Best regards
Uwe

#3 lore raw
Quoted 7 lines · Uwe Kleine-König (The Capable Hub)

Hello,

Quoted 4 lines · 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.

Quoted 7 lines
Quoted 4 lines

While touching this array drop commas before closing curly braces on the same line.

this patch got a review but wasn't picked up yet. Is this still on your radar?

It seems it's not on anyone's radar. Should I resend? Did I pick the right recipients for this patch?

Best regards
Uwe

Applied
#4 lore raw
In reply to Uwe Kleine-König (The Capable Hub)
Quoted 28 lines · 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.

While touching this array drop commas before closing curly braces on the same line.

---
 drivers/extcon/extcon-max14577.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/extcon/extcon-max14577.c +2 -2
index 5476f48ed74b..2c1580ebfc61 100644
@@ -771,8 +771,8 @@ static int max14577_muic_probe(struct platform_device *pdev)
 }
 
 static const struct platform_device_id max14577_muic_id[] = {
-	{ "max14577-muic", MAXIM_DEVICE_TYPE_MAX14577, },
-	{ "max77836-muic", MAXIM_DEVICE_TYPE_MAX77836, },
+	{ .name = "max14577-muic", .driver_data = MAXIM_DEVICE_TYPE_MAX14577 },
+	{ .name = "max77836-muic", .driver_data = MAXIM_DEVICE_TYPE_MAX77836 },
 	{ }
 };
 MODULE_DEVICE_TABLE(platform, max14577_muic_id);
Quoted 1 line

base-commit: 8d6dbbbe3ba62de0a63e962ee004afb848c8e3ac

Applied it. Thanks.

Signature · 3 lines
Best Regards,
Chanwoo Choi
Principal Engineer, Samsung Electronics