* [PATCH v2 0/3] iio: Use named initializers for device_id structures
@ 2026-06-30 15:35 Uwe Kleine-König (The Capable Hub)
2026-06-30 15:35 ` [PATCH v2 3/3] staging: iio: Initialize spi_device_id arrays using member names Uwe Kleine-König (The Capable Hub)
0 siblings, 1 reply; 3+ messages in thread
From: Uwe Kleine-König (The Capable Hub) @ 2026-06-30 15:35 UTC (permalink / raw)
To: Oleksij Rempel, Jonathan Cameron, Nuno Sá, Michael Hennerich,
Greg Kroah-Hartman
Cc: kernel, David Lechner, Andy Shevchenko, linux-iio, linux-kernel,
linux, linux-staging
Hello,
v1 of this series can be found at
https://lore.kernel.org/linux-iio/cover.1781883685.git.u.kleine-koenig@baylibre.com
.
Jonathan already applied most of the v1 series, so here come only the
remaining bits with the following changes:
- Squash the ti-tsc2046 changes together and simplify some more
- Apply the same simplification to the adis16550 driver. Jonathan
asked the ADI people if they have a driver extention in the queue to
actually make use of the device abstraction that is thrown away here.
There was no reply yet, so I thought I'll implement this
simplifictions such that it's clear what we're discussing.
Patch 3 was already part of v1 and Jonathan claimed to have applied it,
but it's not in his testing branch, so I included it here again.
Uwe Kleine-König (The Capable Hub) (3):
iio: adc: ti-tsc2046: Simplify device handling
iio: imu: adis16550: Simplify device abstraction
staging: iio: Initialize spi_device_id arrays using member names
drivers/iio/adc/ti-tsc2046.c | 25 ++------
drivers/iio/imu/adis16550.c | 89 ++++++++------------------
drivers/staging/iio/adc/ad7816.c | 6 +-
drivers/staging/iio/frequency/ad9834.c | 8 +--
4 files changed, 37 insertions(+), 91 deletions(-)
base-commit: 76b8de6371463f29189d4df52f464c3fd6f3328e
--
2.47.3
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2 3/3] staging: iio: Initialize spi_device_id arrays using member names
2026-06-30 15:35 [PATCH v2 0/3] iio: Use named initializers for device_id structures Uwe Kleine-König (The Capable Hub)
@ 2026-06-30 15:35 ` Uwe Kleine-König (The Capable Hub)
2026-06-30 22:59 ` Jonathan Cameron
0 siblings, 1 reply; 3+ messages in thread
From: Uwe Kleine-König (The Capable Hub) @ 2026-06-30 15:35 UTC (permalink / raw)
To: Nuno Sá, Michael Hennerich, Jonathan Cameron,
Greg Kroah-Hartman
Cc: David Lechner, Andy Shevchenko, linux, 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.
The mentioned robustness is relevant for a planned change to struct
spi_device_id that replaces .driver_data by an anonymous union.
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: Nuno Sá <nuno.sa@analog.com>
Link: https://patch.msgid.link/cac7a68e6a6adb1b58207640ab045e59eec86f53.1781883685.git.u.kleine-koenig@baylibre.com
---
drivers/staging/iio/adc/ad7816.c | 6 +++---
drivers/staging/iio/frequency/ad9834.c | 8 ++++----
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/staging/iio/adc/ad7816.c b/drivers/staging/iio/adc/ad7816.c
index 0e32a2295990..30644d2d7c54 100644
--- a/drivers/staging/iio/adc/ad7816.c
+++ b/drivers/staging/iio/adc/ad7816.c
@@ -426,9 +426,9 @@ static const struct of_device_id ad7816_of_match[] = {
MODULE_DEVICE_TABLE(of, ad7816_of_match);
static const struct spi_device_id ad7816_id[] = {
- { "ad7816", ID_AD7816 },
- { "ad7817", ID_AD7817 },
- { "ad7818", ID_AD7818 },
+ { .name = "ad7816", .driver_data = ID_AD7816 },
+ { .name = "ad7817", .driver_data = ID_AD7817 },
+ { .name = "ad7818", .driver_data = ID_AD7818 },
{ }
};
diff --git a/drivers/staging/iio/frequency/ad9834.c b/drivers/staging/iio/frequency/ad9834.c
index 4359b358e0e5..f95c5365cd03 100644
--- a/drivers/staging/iio/frequency/ad9834.c
+++ b/drivers/staging/iio/frequency/ad9834.c
@@ -465,10 +465,10 @@ static int ad9834_probe(struct spi_device *spi)
}
static const struct spi_device_id ad9834_id[] = {
- {"ad9833", ID_AD9833},
- {"ad9834", ID_AD9834},
- {"ad9837", ID_AD9837},
- {"ad9838", ID_AD9838},
+ { .name = "ad9833", .driver_data = ID_AD9833 },
+ { .name = "ad9834", .driver_data = ID_AD9834 },
+ { .name = "ad9837", .driver_data = ID_AD9837 },
+ { .name = "ad9838", .driver_data = ID_AD9838 },
{ }
};
MODULE_DEVICE_TABLE(spi, ad9834_id);
--
2.47.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2 3/3] staging: iio: Initialize spi_device_id arrays using member names
2026-06-30 15:35 ` [PATCH v2 3/3] staging: iio: Initialize spi_device_id arrays using member names Uwe Kleine-König (The Capable Hub)
@ 2026-06-30 22:59 ` Jonathan Cameron
0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2026-06-30 22:59 UTC (permalink / raw)
To: Uwe Kleine-König (The Capable Hub)
Cc: Nuno Sá, Michael Hennerich, Greg Kroah-Hartman,
David Lechner, Andy Shevchenko, linux, linux-iio, linux-staging,
linux-kernel
On Tue, 30 Jun 2026 17:35:36 +0200
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.
>
> The mentioned robustness is relevant for a planned change to struct
> spi_device_id that replaces .driver_data by an anonymous union.
>
> 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: Nuno Sá <nuno.sa@analog.com>
> Link: https://patch.msgid.link/cac7a68e6a6adb1b58207640ab045e59eec86f53.1781883685.git.u.kleine-koenig@baylibre.com
Given I messed up applying this in v1, picked up now.
Thanks for catching that miss!
Jonathan
> ---
> drivers/staging/iio/adc/ad7816.c | 6 +++---
> drivers/staging/iio/frequency/ad9834.c | 8 ++++----
> 2 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/staging/iio/adc/ad7816.c b/drivers/staging/iio/adc/ad7816.c
> index 0e32a2295990..30644d2d7c54 100644
> --- a/drivers/staging/iio/adc/ad7816.c
> +++ b/drivers/staging/iio/adc/ad7816.c
> @@ -426,9 +426,9 @@ static const struct of_device_id ad7816_of_match[] = {
> MODULE_DEVICE_TABLE(of, ad7816_of_match);
>
> static const struct spi_device_id ad7816_id[] = {
> - { "ad7816", ID_AD7816 },
> - { "ad7817", ID_AD7817 },
> - { "ad7818", ID_AD7818 },
> + { .name = "ad7816", .driver_data = ID_AD7816 },
> + { .name = "ad7817", .driver_data = ID_AD7817 },
> + { .name = "ad7818", .driver_data = ID_AD7818 },
> { }
> };
>
> diff --git a/drivers/staging/iio/frequency/ad9834.c b/drivers/staging/iio/frequency/ad9834.c
> index 4359b358e0e5..f95c5365cd03 100644
> --- a/drivers/staging/iio/frequency/ad9834.c
> +++ b/drivers/staging/iio/frequency/ad9834.c
> @@ -465,10 +465,10 @@ static int ad9834_probe(struct spi_device *spi)
> }
>
> static const struct spi_device_id ad9834_id[] = {
> - {"ad9833", ID_AD9833},
> - {"ad9834", ID_AD9834},
> - {"ad9837", ID_AD9837},
> - {"ad9838", ID_AD9838},
> + { .name = "ad9833", .driver_data = ID_AD9833 },
> + { .name = "ad9834", .driver_data = ID_AD9834 },
> + { .name = "ad9837", .driver_data = ID_AD9837 },
> + { .name = "ad9838", .driver_data = ID_AD9838 },
> { }
> };
> MODULE_DEVICE_TABLE(spi, ad9834_id);
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-06-30 22:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-30 15:35 [PATCH v2 0/3] iio: Use named initializers for device_id structures Uwe Kleine-König (The Capable Hub)
2026-06-30 15:35 ` [PATCH v2 3/3] staging: iio: Initialize spi_device_id arrays using member names Uwe Kleine-König (The Capable Hub)
2026-06-30 22:59 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox