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: "David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Antoniu Miclaus" <antoniu.miclaus@analog.com>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 05/13] iio: dac: max5522: Simplify device abstraction
Date: Wed, 24 Jun 2026 18:38:37 +0100	[thread overview]
Message-ID: <20260624183837.78aae906@jic23-huawei> (raw)
In-Reply-To: <54b79462e753b99c132a835f6b618b3cef76fa9c.1781883685.git.u.kleine-koenig@baylibre.com>

On Fri, 19 Jun 2026 17:54:33 +0200
Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com> wrote:

> The driver only supports a single chip variant since it's birth in 2022.
> Both the spi id_table and the of id_table are essentially unused (only
> assigned to a write-only member in private data).
> 
> Hardcode the device name and then drop various unused stuff from the
> driver. While touching the spi id_table assign .name using a named
> initializer.
> 
> Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
Hmm. This one was a bit silly wasn't it? :)

Applied.

> ---
>  drivers/iio/dac/max5522.c | 31 +++----------------------------
>  1 file changed, 3 insertions(+), 28 deletions(-)
> 
> diff --git a/drivers/iio/dac/max5522.c b/drivers/iio/dac/max5522.c
> index b52a9cc1da79..cfbe3a6e0449 100644
> --- a/drivers/iio/dac/max5522.c
> +++ b/drivers/iio/dac/max5522.c
> @@ -25,15 +25,8 @@
>  
>  #define MAX5522_REG_DATA(x)	((x) + MAX5522_CTRL_LOAD_IN_A)
>  
> -struct max5522_chip_info {
> -	const char *name;
> -	const struct iio_chan_spec *channels;
> -	unsigned int num_channels;
> -};
> -
>  struct max5522_state {
>  	struct regmap *regmap;
> -	const struct max5522_chip_info *chip_info;
>  	unsigned short dac_cache[2];
>  	int vref_mV;
>  };
> @@ -58,18 +51,6 @@ static const struct iio_chan_spec max5522_channels[] = {
>  	MAX5522_CHANNEL(1),
>  };
>  
> -enum max5522_type {
> -	ID_MAX5522,
> -};
> -
> -static const struct max5522_chip_info max5522_chip_info_tbl[] = {
> -	[ID_MAX5522] = {
> -		.name = "max5522",
> -		.channels = max5522_channels,
> -		.num_channels = 2,
> -	},
> -};
> -
>  static inline int max5522_info_to_reg(struct iio_chan_spec const *chan)
>  {
>  	return MAX5522_REG_DATA(chan->channel);
> @@ -140,9 +121,6 @@ static int max5522_spi_probe(struct spi_device *spi)
>  	}
>  
>  	state = iio_priv(indio_dev);
> -	state->chip_info = spi_get_device_match_data(spi);
> -	if (!state->chip_info)
> -		return -EINVAL;
>  
>  	ret = devm_regulator_get_enable_read_voltage(&spi->dev, "vrefin");
>  	if (ret < 0)
> @@ -159,22 +137,19 @@ static int max5522_spi_probe(struct spi_device *spi)
>  	indio_dev->modes = INDIO_DIRECT_MODE;
>  	indio_dev->channels = max5522_channels;
>  	indio_dev->num_channels = ARRAY_SIZE(max5522_channels);
> -	indio_dev->name = max5522_chip_info_tbl[ID_MAX5522].name;
> +	indio_dev->name = "max5522";
>  
>  	return devm_iio_device_register(&spi->dev, indio_dev);
>  }
>  
>  static const struct spi_device_id max5522_ids[] = {
> -	{ "max5522", (kernel_ulong_t)&max5522_chip_info_tbl[ID_MAX5522] },
> +	{ .name = "max5522" },
>  	{ }
>  };
>  MODULE_DEVICE_TABLE(spi, max5522_ids);
>  
>  static const struct of_device_id max5522_of_match[] = {
> -	{
> -		.compatible = "maxim,max5522",
> -		.data = &max5522_chip_info_tbl[ID_MAX5522],
> -	},
> +	{ .compatible = "maxim,max5522" },
>  	{ }
>  };
>  MODULE_DEVICE_TABLE(of, max5522_of_match);


  reply	other threads:[~2026-06-24 17:38 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-19 15:54 [PATCH v1 00/13] iio: Use named initializers for device_id structures Uwe Kleine-König (The Capable Hub)
2026-06-19 15:54 ` [PATCH v1 01/13] iio: Initialize i2c_device_id arrays using member names (part 2) Uwe Kleine-König (The Capable Hub)
2026-06-24 17:34   ` Jonathan Cameron
2026-06-19 15:54 ` [PATCH v1 02/13] iio: adc: ti-tsc2046: Simplify device abstraction Uwe Kleine-König (The Capable Hub)
2026-06-19 15:54 ` [PATCH v1 03/13] iio: adc: ti-tsc2046: Drop unused member from private data Uwe Kleine-König (The Capable Hub)
2026-06-22 10:30   ` Andy Shevchenko
2026-06-22 13:32     ` Uwe Kleine-König (The Capable Hub)
2026-06-19 15:54 ` [PATCH v1 04/13] iio: adc: max1241: Simplify device abstraction Uwe Kleine-König (The Capable Hub)
2026-06-24 17:37   ` Jonathan Cameron
2026-06-19 15:54 ` [PATCH v1 05/13] iio: dac: max5522: " Uwe Kleine-König (The Capable Hub)
2026-06-24 17:38   ` Jonathan Cameron [this message]
2026-06-19 15:54 ` [PATCH v1 06/13] iio: frequency: ad9523: Simplify driver a bit Uwe Kleine-König (The Capable Hub)
2026-06-24 17:43   ` Jonathan Cameron
2026-06-19 15:54 ` [PATCH v1 07/13] iio: imu: adis16550: Simplify device abstraction Uwe Kleine-König (The Capable Hub)
2026-06-24 17:47   ` Jonathan Cameron
2026-06-19 15:54 ` [PATCH v1 08/13] iio: magnetometer: hmc5843: " Uwe Kleine-König (The Capable Hub)
2026-06-24 17:48   ` Jonathan Cameron
2026-06-19 15:54 ` [PATCH v1 09/13] iio: accel: bmc150: Explicitly set spi .driver_data Uwe Kleine-König (The Capable Hub)
2026-06-24 17:50   ` Jonathan Cameron
2026-06-19 15:54 ` [PATCH v1 10/13] iio: Drop unused assignment of spi_device_id driver data Uwe Kleine-König (The Capable Hub)
2026-06-19 15:54 ` [PATCH v1 11/13] iio: Initialize spi_device_id arrays using member names Uwe Kleine-König (The Capable Hub)
2026-06-19 20:19   ` Linus Walleij
2026-06-24 17:52     ` Jonathan Cameron
2026-06-19 15:54 ` [PATCH v1 12/13] staging: iio: Drop unused assignment of spi_device_id driver data Uwe Kleine-König (The Capable Hub)
2026-06-19 15:54 ` [PATCH v1 13/13] staging: iio: Initialize spi_device_id arrays using member names Uwe Kleine-König (The Capable Hub)
2026-06-24 17:54   ` Jonathan Cameron
2026-06-26 13:18     ` Uwe Kleine-König (The Capable Hub)
2026-06-22 11:43 ` [PATCH v1 00/13] iio: Use named initializers for device_id structures Nuno Sá

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=20260624183837.78aae906@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=andy@kernel.org \
    --cc=antoniu.miclaus@analog.com \
    --cc=dlechner@baylibre.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --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