Skip to contentSkip to conversation

dpll: zl3073x: Use named initializers for struct i2c_device_id

PATCH Applied Uwe Kleine-König (The Capable Hub) 3 participants 3 messages May 19 – May 21

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

PATCH 1/1 dpll: zl3073x: Use named initializers for struct i2c_device_id

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.

This patch doesn't modify the compiled arrays, only their representation in source form benefits. The former was confirmed with x86 and arm64 builds.

---
Hello,

this patch is part of a bigger quest to use named initializers for mainly struct i2c_device_id::driver_data to be able to modify i2c_device_id. See e.g.
https://lore.kernel.org/all/[email protected]/
for the details.

This patch here isn't critical for this quest, as no driver makes use of .driver_data, so apart from the better readability this is only about consistency with other subsystems.

This is the only i2c driver under drivers/dpll, so this is the only patch needed to adapt the whole system to the new style for initializing i2c_device_id arrays.

Best regards
Uwe

---
 drivers/dpll/zl3073x/i2c.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/dpll/zl3073x/i2c.c +5 -5
index 979df85826ab..4a23340e29d0 100644
@@ -26,11 +26,11 @@ static int zl3073x_i2c_probe(struct i2c_client *client)
 }
 
 static const struct i2c_device_id zl3073x_i2c_id[] = {
-	{ "zl30731" },
-	{ "zl30732" },
-	{ "zl30733" },
-	{ "zl30734" },
-	{ "zl30735" },
+	{ .name = "zl30731" },
+	{ .name = "zl30732" },
+	{ .name = "zl30733" },
+	{ .name = "zl30734" },
+	{ .name = "zl30735" },
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(i2c, zl3073x_i2c_id);

base-commit: 254f49634ee16a731174d2ae34bc50bd5f45e731

Signature · 1 line
2.47.3
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Uwe Kleine-König (The Capable Hub)

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.

This patch doesn't modify the compiled arrays, only their representation in source form benefits. The former was confirmed with x86 and arm64 builds.

LGTM...

#2 lore raw
In reply to Uwe Kleine-König (The Capable Hub)
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 10 lines · On Tue, 19 May 2026 16:27:10 +0200 you wrote:

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.

This patch doesn't modify the compiled arrays, only their representation in source form benefits. The former was confirmed with x86 and arm64 builds.

[...]

Here is the summary with links:
- [v1] dpll: zl3073x: Use named initializers for struct i2c_device_id

    https://git.kernel.org/netdev/net-next/c/a09dfac0296d

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html