Linux kernel staging patches
 help / color / mirror / Atom feed
* [PATCH v1] staging: iio: Use named initializers for struct i2c_device_id
@ 2026-05-19 14:06 Uwe Kleine-König (The Capable Hub)
  2026-05-19 14:20 ` Joshua Crofts
  2026-05-20 12:21 ` Stepan Ionichev
  0 siblings, 2 replies; 4+ messages in thread
From: Uwe Kleine-König (The Capable Hub) @ 2026-05-19 14:06 UTC (permalink / raw)
  To: Jonathan Cameron, Greg Kroah-Hartman
  Cc: Lars-Peter Clausen, Michael Hennerich, David Lechner,
	Nuno Sá, Andy Shevchenko, linux-iio, linux-staging,
	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 no driver makes use of
.driver_data, so apart from the better readability this is only about
consistency with other subsystems.

Best regards
Uwe

 drivers/staging/iio/addac/adt7316-i2c.c         | 12 ++++++------
 drivers/staging/iio/impedance-analyzer/ad5933.c |  4 ++--
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/iio/addac/adt7316-i2c.c b/drivers/staging/iio/addac/adt7316-i2c.c
index 3bdaee925dee..98f2e23c6a4b 100644
--- a/drivers/staging/iio/addac/adt7316-i2c.c
+++ b/drivers/staging/iio/addac/adt7316-i2c.c
@@ -109,12 +109,12 @@ static int adt7316_i2c_probe(struct i2c_client *client)
 }
 
 static const struct i2c_device_id adt7316_i2c_id[] = {
-	{ "adt7316" },
-	{ "adt7317" },
-	{ "adt7318" },
-	{ "adt7516" },
-	{ "adt7517" },
-	{ "adt7519" },
+	{ .name = "adt7316" },
+	{ .name = "adt7317" },
+	{ .name = "adt7318" },
+	{ .name = "adt7516" },
+	{ .name = "adt7517" },
+	{ .name = "adt7519" },
 	{ }
 };
 
diff --git a/drivers/staging/iio/impedance-analyzer/ad5933.c b/drivers/staging/iio/impedance-analyzer/ad5933.c
index dde2ec9d1f6a..798e62bae29b 100644
--- a/drivers/staging/iio/impedance-analyzer/ad5933.c
+++ b/drivers/staging/iio/impedance-analyzer/ad5933.c
@@ -726,8 +726,8 @@ static int ad5933_probe(struct i2c_client *client)
 }
 
 static const struct i2c_device_id ad5933_id[] = {
-	{ "ad5933" },
-	{ "ad5934" },
+	{ .name = "ad5933" },
+	{ .name = "ad5934" },
 	{ }
 };
 

base-commit: 254f49634ee16a731174d2ae34bc50bd5f45e731
-- 
2.47.3


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

* Re: [PATCH v1] staging: iio: Use named initializers for struct i2c_device_id
  2026-05-19 14:06 [PATCH v1] staging: iio: Use named initializers for struct i2c_device_id Uwe Kleine-König (The Capable Hub)
@ 2026-05-19 14:20 ` Joshua Crofts
  2026-05-20 12:21 ` Stepan Ionichev
  1 sibling, 0 replies; 4+ messages in thread
From: Joshua Crofts @ 2026-05-19 14:20 UTC (permalink / raw)
  To: Uwe Kleine-König (The Capable Hub)
  Cc: Jonathan Cameron, Greg Kroah-Hartman, Lars-Peter Clausen,
	Michael Hennerich, David Lechner, Nuno Sá, Andy Shevchenko,
	linux-iio, linux-staging, linux-kernel

On Tue, 19 May 2026 at 16:17, Uwe Kleine-König (The Capable Hub)
<u.kleine-koenig@baylibre.com> 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>
> ---

Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>

-- 
Kind regards

CJD

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

* Re: [PATCH v1] staging: iio: Use named initializers for struct i2c_device_id
  2026-05-19 14:06 [PATCH v1] staging: iio: Use named initializers for struct i2c_device_id Uwe Kleine-König (The Capable Hub)
  2026-05-19 14:20 ` Joshua Crofts
@ 2026-05-20 12:21 ` Stepan Ionichev
  2026-05-20 19:01   ` Jonathan Cameron
  1 sibling, 1 reply; 4+ messages in thread
From: Stepan Ionichev @ 2026-05-20 12:21 UTC (permalink / raw)
  To: u.kleine-koenig
  Cc: jic23, gregkh, lars, Michael.Hennerich, dlechner, nuno.sa, andy,
	linux-iio, linux-staging, linux-kernel, Stepan Ionichev

Reviewed-by: Stepan Ionichev <sozdayvek@gmail.com>

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

* Re: [PATCH v1] staging: iio: Use named initializers for struct i2c_device_id
  2026-05-20 12:21 ` Stepan Ionichev
@ 2026-05-20 19:01   ` Jonathan Cameron
  0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Cameron @ 2026-05-20 19:01 UTC (permalink / raw)
  To: Stepan Ionichev
  Cc: u.kleine-koenig, gregkh, lars, Michael.Hennerich, dlechner,
	nuno.sa, andy, linux-iio, linux-staging, linux-kernel

On Wed, 20 May 2026 17:21:05 +0500
Stepan Ionichev <sozdayvek@gmail.com> wrote:

> Reviewed-by: Stepan Ionichev <sozdayvek@gmail.com>
> 

Applied.

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

end of thread, other threads:[~2026-05-20 19:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-19 14:06 [PATCH v1] staging: iio: Use named initializers for struct i2c_device_id Uwe Kleine-König (The Capable Hub)
2026-05-19 14:20 ` Joshua Crofts
2026-05-20 12:21 ` Stepan Ionichev
2026-05-20 19:01   ` Jonathan Cameron

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