Linux-PHY Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] phy: nxp-ptn3222: Use named initializers for struct i2c_device_id
@ 2026-05-19 15:19 Uwe Kleine-König (The Capable Hub)
  2026-06-10 17:21 ` Uwe Kleine-König (The Capable Hub)
  0 siblings, 1 reply; 2+ messages in thread
From: Uwe Kleine-König (The Capable Hub) @ 2026-05-19 15:19 UTC (permalink / raw)
  To: Vinod Koul; +Cc: Neil Armstrong, linux-phy, linux-kernel

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.

Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
---
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/20260518111203.639603-2-u.kleine-koenig@baylibre.com/
for the details.

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

Best regards
Uwe

 drivers/phy/phy-nxp-ptn3222.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/phy/phy-nxp-ptn3222.c b/drivers/phy/phy-nxp-ptn3222.c
index c6179d8701e6..6cb79b5c4fdb 100644
--- a/drivers/phy/phy-nxp-ptn3222.c
+++ b/drivers/phy/phy-nxp-ptn3222.c
@@ -97,7 +97,7 @@ static int ptn3222_probe(struct i2c_client *client)
 }
 
 static const struct i2c_device_id ptn3222_table[] = {
-	{ "ptn3222" },
+	{ .name = "ptn3222" },
 	{ }
 };
 MODULE_DEVICE_TABLE(i2c, ptn3222_table);

base-commit: 254f49634ee16a731174d2ae34bc50bd5f45e731
-- 
2.47.3


-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

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

* Re: [PATCH v1] phy: nxp-ptn3222: Use named initializers for struct i2c_device_id
  2026-05-19 15:19 [PATCH v1] phy: nxp-ptn3222: Use named initializers for struct i2c_device_id Uwe Kleine-König (The Capable Hub)
@ 2026-06-10 17:21 ` Uwe Kleine-König (The Capable Hub)
  0 siblings, 0 replies; 2+ messages in thread
From: Uwe Kleine-König (The Capable Hub) @ 2026-06-10 17:21 UTC (permalink / raw)
  To: Vinod Koul; +Cc: Neil Armstrong, linux-phy, linux-kernel


[-- Attachment #1.1: Type: text/plain, Size: 1485 bytes --]

Hello Vinod,

On Tue, May 19, 2026 at 05:19:57PM +0200, Uwe Kleine-König (The Capable Hub) 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.
> 
> Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
> ---
> 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/20260518111203.639603-2-u.kleine-koenig@baylibre.com/
> for the details.
> 
> This patch here isn't critical for this quest, as the driver doesn't
> make use of .driver_data, so apart from the better readability this is
> only about consistency with other subsystems.

Given that this patch isn't necessary for my onging patch quest, I don't
care much, but I still think this is an improvement so it would be sad
if this patch wasn't applied just because it's on nobody's radar any
more.

Do you consider to apply this patch? If you don't like it, that's fine,
but then please say so, then I drop it from my trackine.

Best regards
UWe

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 112 bytes --]

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

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

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

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-19 15:19 [PATCH v1] phy: nxp-ptn3222: Use named initializers for struct i2c_device_id Uwe Kleine-König (The Capable Hub)
2026-06-10 17:21 ` 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