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: "Oleksij Rempel" <o.rempel@pengutronix.de>,
	kernel@pengutronix.de, "David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/3] iio: adc: ti-tsc2046: Simplify device handling
Date: Wed, 1 Jul 2026 00:02:31 +0100	[thread overview]
Message-ID: <20260701000231.6b2ca57f@jic23-huawei> (raw)
In-Reply-To: <a3329201c27a1f2439f4b6c1c89cd1949dcab23c.1782833415.git.u.kleine-koenig@baylibre.com>

On Tue, 30 Jun 2026 17:35:34 +0200
Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com> wrote:

> The driver was introduced in 2021 and since then only supports a single
> chip variant. Simplify the driver by hard-coding the device properties
> instead of using the id_table's abstraction for a single chip type.
> 
> Also drop the write-only struct member dcfg and the then unused struct
> definition.
> 
> Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
Addresses feedback on v1, so all good,

Applied to the testing branch of iio.git.

I'll sit on patch 2 for a little while to see if it stirs up discussion!

Jonathan

> ---
>  drivers/iio/adc/ti-tsc2046.c | 25 ++++---------------------
>  1 file changed, 4 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/iio/adc/ti-tsc2046.c b/drivers/iio/adc/ti-tsc2046.c
> index aba4b10a17ac..125f6d7e2d84 100644
> --- a/drivers/iio/adc/ti-tsc2046.c
> +++ b/drivers/iio/adc/ti-tsc2046.c
> @@ -121,11 +121,6 @@ struct tsc2046_adc_group_layout {
>  	unsigned int skip;
>  };
>  
> -struct tsc2046_adc_dcfg {
> -	const struct iio_chan_spec *channels;
> -	unsigned int num_channels;
> -};
> -
>  struct tsc2046_adc_ch_cfg {
>  	unsigned int settling_time_us;
>  	unsigned int oversampling_ratio;
> @@ -141,7 +136,6 @@ enum tsc2046_state {
>  
>  struct tsc2046_adc_priv {
>  	struct spi_device *spi;
> -	const struct tsc2046_adc_dcfg *dcfg;
>  	bool internal_vref;
>  
>  	struct iio_trigger *trig;
> @@ -214,11 +208,6 @@ const struct iio_chan_spec name ## _channels[] = { \
>  
>  static DECLARE_TI_TSC2046_8_CHANNELS(tsc2046_adc, 12);
>  
> -static const struct tsc2046_adc_dcfg tsc2046_adc_dcfg_tsc2046e = {
> -	.channels = tsc2046_adc_channels,
> -	.num_channels = ARRAY_SIZE(tsc2046_adc_channels),
> -};
> -
>  /*
>   * Convert time to a number of samples which can be transferred within this
>   * time.
> @@ -739,7 +728,6 @@ static void tsc2046_adc_parse_fwnode(struct tsc2046_adc_priv *priv)
>  
>  static int tsc2046_adc_probe(struct spi_device *spi)
>  {
> -	const struct tsc2046_adc_dcfg *dcfg;
>  	struct device *dev = &spi->dev;
>  	struct tsc2046_adc_priv *priv;
>  	struct iio_dev *indio_dev;
> @@ -752,10 +740,6 @@ static int tsc2046_adc_probe(struct spi_device *spi)
>  		return -EINVAL;
>  	}
>  
> -	dcfg = spi_get_device_match_data(spi);
> -	if (!dcfg)
> -		return -EINVAL;
> -
>  	spi->mode &= ~SPI_MODE_X_MASK;
>  	spi->mode |= SPI_MODE_0;
>  	ret = spi_setup(spi);
> @@ -767,14 +751,13 @@ static int tsc2046_adc_probe(struct spi_device *spi)
>  		return -ENOMEM;
>  
>  	priv = iio_priv(indio_dev);
> -	priv->dcfg = dcfg;
>  
>  	priv->spi = spi;
>  
>  	indio_dev->name = TI_TSC2046_NAME;
>  	indio_dev->modes = INDIO_DIRECT_MODE;
> -	indio_dev->channels = dcfg->channels;
> -	indio_dev->num_channels = dcfg->num_channels;
> +	indio_dev->channels = tsc2046_adc_channels;
> +	indio_dev->num_channels = ARRAY_SIZE(tsc2046_adc_channels);
>  	indio_dev->info = &tsc2046_adc_info;
>  
>  	ret = devm_regulator_get_enable_read_voltage(dev, "vref");
> @@ -829,13 +812,13 @@ static int tsc2046_adc_probe(struct spi_device *spi)
>  }
>  
>  static const struct of_device_id ads7950_of_table[] = {
> -	{ .compatible = "ti,tsc2046e-adc", .data = &tsc2046_adc_dcfg_tsc2046e },
> +	{ .compatible = "ti,tsc2046e-adc" },
>  	{ }
>  };
>  MODULE_DEVICE_TABLE(of, ads7950_of_table);
>  
>  static const struct spi_device_id tsc2046_adc_spi_ids[] = {
> -	{ "tsc2046e-adc", (unsigned long)&tsc2046_adc_dcfg_tsc2046e },
> +	{ .name = "tsc2046e-adc" },
>  	{ }
>  };
>  MODULE_DEVICE_TABLE(spi, tsc2046_adc_spi_ids);


  reply	other threads:[~2026-06-30 23:02 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 [this message]
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

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=20260701000231.6b2ca57f@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=o.rempel@pengutronix.de \
    --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