Netdev List
 help / color / mirror / Atom feed
* [PATCH v1] mctp: i2c: Use named initializers for struct i2c_device_id
@ 2026-05-19 15:36 Uwe Kleine-König (The Capable Hub)
  2026-05-19 17:26 ` Jeremy Kerr
  0 siblings, 1 reply; 2+ messages in thread
From: Uwe Kleine-König (The Capable Hub) @ 2026-05-19 15:36 UTC (permalink / raw)
  To: Jeremy Kerr, Matt Johnston
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, netdev, 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.

While touching this array, unify usage of whitespace in the list
terminator to what most other arrays are using.

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 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/net/mctp, so this is the only
patch needed to adapt the whole subsystem to the new style for
initializing i2c_device_id arrays.

Best regards
Uwe

 drivers/net/mctp/mctp-i2c.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mctp/mctp-i2c.c b/drivers/net/mctp/mctp-i2c.c
index 15fe4d1163c1..24e0dd01f180 100644
--- a/drivers/net/mctp/mctp-i2c.c
+++ b/drivers/net/mctp/mctp-i2c.c
@@ -1101,8 +1101,8 @@ static struct notifier_block mctp_i2c_notifier = {
 };
 
 static const struct i2c_device_id mctp_i2c_id[] = {
-	{ "mctp-i2c-interface" },
-	{}
+	{ .name = "mctp-i2c-interface" },
+	{ }
 };
 MODULE_DEVICE_TABLE(i2c, mctp_i2c_id);
 

base-commit: 254f49634ee16a731174d2ae34bc50bd5f45e731
-- 
2.47.3


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

end of thread, other threads:[~2026-05-19 17:26 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:36 [PATCH v1] mctp: i2c: Use named initializers for struct i2c_device_id Uwe Kleine-König (The Capable Hub)
2026-05-19 17:26 ` Jeremy Kerr

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