Linux IIO development
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: "Uwe Kleine-König (The Capable Hub)" <u.kleine-koenig@baylibre.com>
Cc: "Nuno Sá" <nuno.sa@analog.com>,
	"Michael Hennerich" <Michael.Hennerich@analog.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"David Lechner" <dlechner@baylibre.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	linux@analog.com, linux-iio@vger.kernel.org,
	linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 3/3] staging: iio: Initialize spi_device_id arrays using member names
Date: Tue, 30 Jun 2026 23:59:35 +0100	[thread overview]
Message-ID: <20260630235935.4cfa827c@jic23-huawei> (raw)
In-Reply-To: <4c743f86ca4072d34d715333589aa540aed895f2.1782833415.git.u.kleine-koenig@baylibre.com>

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);


      reply	other threads:[~2026-06-30 22:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 1/3] iio: adc: ti-tsc2046: Simplify device handling Uwe Kleine-König (The Capable Hub)
2026-06-30 23:02   ` Jonathan Cameron
2026-07-01  4:41   ` Oleksij Rempel
2026-06-30 15:35 ` [PATCH v2 2/3] iio: imu: adis16550: Simplify device abstraction Uwe Kleine-König (The Capable Hub)
2026-07-01 15:14   ` Nuno Sá
2026-07-01 17:40     ` Jonathan Cameron
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260630235935.4cfa827c@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=Michael.Hennerich@analog.com \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=linux@analog.com \
    --cc=nuno.sa@analog.com \
    --cc=u.kleine-koenig@baylibre.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox