linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iio: adc: remove unused private data assigned with spi_set_drvdata()
@ 2021-05-13 11:10 Alexandru Ardelean
  2021-05-13 11:21 ` Alexandru Lazar
  0 siblings, 1 reply; 5+ messages in thread
From: Alexandru Ardelean @ 2021-05-13 11:10 UTC (permalink / raw)
  To: linux-iio, linux-kernel
  Cc: jic23, kernel, dmuprhy, martenli, alazar, tremyfr, linux,
	Alexandru Ardelean

These were usually used before the conversion to devm_ functions, so that
the remove hook would be able to retrieve the pointer and do cleanups on
remove.
When the conversion happened, they should have been removed, but were
omitted.

Some drivers were copied from drivers that fit the criteria described
above. In any case, in order to prevent more drivers from being used as
example (and have spi_set_drvdata() needlessly set), this change removes it
from the IIO ADC group.

Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
---
 drivers/iio/adc/ad7476.c        | 2 --
 drivers/iio/adc/ad7766.c        | 2 --
 drivers/iio/adc/ad7768-1.c      | 1 -
 drivers/iio/adc/ad7887.c        | 1 -
 drivers/iio/adc/ad9467.c        | 2 --
 drivers/iio/adc/hi8435.c        | 1 -
 drivers/iio/adc/max1027.c       | 2 --
 drivers/iio/adc/max1241.c       | 2 --
 drivers/iio/adc/ti-adc084s021.c | 3 ---
 drivers/iio/adc/ti-ads124s08.c  | 2 --
 drivers/iio/adc/ti-tsc2046.c    | 2 --
 11 files changed, 20 deletions(-)

diff --git a/drivers/iio/adc/ad7476.c b/drivers/iio/adc/ad7476.c
index 9d5a71df02b0..a1e8b32671cf 100644
--- a/drivers/iio/adc/ad7476.c
+++ b/drivers/iio/adc/ad7476.c
@@ -389,8 +389,6 @@ static int ad7476_probe(struct spi_device *spi)
 	if (IS_ERR(st->convst_gpio))
 		return PTR_ERR(st->convst_gpio);
 
-	spi_set_drvdata(spi, indio_dev);
-
 	st->spi = spi;
 
 	indio_dev->name = spi_get_device_id(spi)->name;
diff --git a/drivers/iio/adc/ad7766.c b/drivers/iio/adc/ad7766.c
index 236a455aaa18..61184ef24140 100644
--- a/drivers/iio/adc/ad7766.c
+++ b/drivers/iio/adc/ad7766.c
@@ -273,8 +273,6 @@ static int ad7766_probe(struct spi_device *spi)
 			return ret;
 	}
 
-	spi_set_drvdata(spi, indio_dev);
-
 	ad7766->spi = spi;
 
 	/* First byte always 0 */
diff --git a/drivers/iio/adc/ad7768-1.c b/drivers/iio/adc/ad7768-1.c
index 41752777e96c..8615485490b3 100644
--- a/drivers/iio/adc/ad7768-1.c
+++ b/drivers/iio/adc/ad7768-1.c
@@ -610,7 +610,6 @@ static int ad7768_probe(struct spi_device *spi)
 
 	st->mclk_freq = clk_get_rate(st->mclk);
 
-	spi_set_drvdata(spi, indio_dev);
 	mutex_init(&st->lock);
 
 	indio_dev->channels = ad7768_channels;
diff --git a/drivers/iio/adc/ad7887.c b/drivers/iio/adc/ad7887.c
index 9b3cbe1ddc6f..f64999714a4d 100644
--- a/drivers/iio/adc/ad7887.c
+++ b/drivers/iio/adc/ad7887.c
@@ -268,7 +268,6 @@ static int ad7887_probe(struct spi_device *spi)
 	st->chip_info =
 		&ad7887_chip_info_tbl[spi_get_device_id(spi)->driver_data];
 
-	spi_set_drvdata(spi, indio_dev);
 	st->spi = spi;
 
 	indio_dev->name = spi_get_device_id(spi)->name;
diff --git a/drivers/iio/adc/ad9467.c b/drivers/iio/adc/ad9467.c
index 19a45dd43796..dbfc8517cb8a 100644
--- a/drivers/iio/adc/ad9467.c
+++ b/drivers/iio/adc/ad9467.c
@@ -434,8 +434,6 @@ static int ad9467_probe(struct spi_device *spi)
 		mdelay(10);
 	}
 
-	spi_set_drvdata(spi, st);
-
 	conv->chip_info = &info->axi_adc_info;
 
 	id = ad9467_spi_read(spi, AN877_ADC_REG_CHIP_ID);
diff --git a/drivers/iio/adc/hi8435.c b/drivers/iio/adc/hi8435.c
index 074c30970465..8b353e26668e 100644
--- a/drivers/iio/adc/hi8435.c
+++ b/drivers/iio/adc/hi8435.c
@@ -483,7 +483,6 @@ static int hi8435_probe(struct spi_device *spi)
 		gpiod_set_value_cansleep(reset_gpio, 1);
 	}
 
-	spi_set_drvdata(spi, idev);
 	mutex_init(&priv->lock);
 
 	idev->name		= spi_get_device_id(spi)->name;
diff --git a/drivers/iio/adc/max1027.c b/drivers/iio/adc/max1027.c
index e3c8ec107722..655ab02d03d8 100644
--- a/drivers/iio/adc/max1027.c
+++ b/drivers/iio/adc/max1027.c
@@ -430,8 +430,6 @@ static int max1027_probe(struct spi_device *spi)
 		return -ENOMEM;
 	}
 
-	spi_set_drvdata(spi, indio_dev);
-
 	st = iio_priv(indio_dev);
 	st->spi = spi;
 	st->info = &max1027_chip_info_tbl[spi_get_device_id(spi)->driver_data];
diff --git a/drivers/iio/adc/max1241.c b/drivers/iio/adc/max1241.c
index 0cbbb3c56d08..b60f8448f21a 100644
--- a/drivers/iio/adc/max1241.c
+++ b/drivers/iio/adc/max1241.c
@@ -147,8 +147,6 @@ static int max1241_probe(struct spi_device *spi)
 	adc->spi = spi;
 	mutex_init(&adc->lock);
 
-	spi_set_drvdata(spi, indio_dev);
-
 	adc->vdd = devm_regulator_get(dev, "vdd");
 	if (IS_ERR(adc->vdd)) {
 		dev_err(dev, "failed to get vdd regulator\n");
diff --git a/drivers/iio/adc/ti-adc084s021.c b/drivers/iio/adc/ti-adc084s021.c
index 33aea961d850..ce3f5a3814f9 100644
--- a/drivers/iio/adc/ti-adc084s021.c
+++ b/drivers/iio/adc/ti-adc084s021.c
@@ -210,9 +210,6 @@ static int adc084s021_probe(struct spi_device *spi)
 	adc = iio_priv(indio_dev);
 	adc->spi = spi;
 
-	/* Connect the SPI device and the iio dev */
-	spi_set_drvdata(spi, indio_dev);
-
 	/* Initiate the Industrial I/O device */
 	indio_dev->name = spi_get_device_id(spi)->name;
 	indio_dev->modes = INDIO_DIRECT_MODE;
diff --git a/drivers/iio/adc/ti-ads124s08.c b/drivers/iio/adc/ti-ads124s08.c
index b4a128b19188..17d0da5877a9 100644
--- a/drivers/iio/adc/ti-ads124s08.c
+++ b/drivers/iio/adc/ti-ads124s08.c
@@ -327,8 +327,6 @@ static int ads124s_probe(struct spi_device *spi)
 
 	ads124s_priv->chip_info = &ads124s_chip_info_tbl[spi_id->driver_data];
 
-	spi_set_drvdata(spi, indio_dev);
-
 	ads124s_priv->spi = spi;
 
 	indio_dev->name = spi_id->name;
diff --git a/drivers/iio/adc/ti-tsc2046.c b/drivers/iio/adc/ti-tsc2046.c
index 89a818b653b4..26c98b3d74f1 100644
--- a/drivers/iio/adc/ti-tsc2046.c
+++ b/drivers/iio/adc/ti-tsc2046.c
@@ -639,8 +639,6 @@ static int tsc2046_adc_probe(struct spi_device *spi)
 	priv = iio_priv(indio_dev);
 	priv->dcfg = dcfg;
 
-	spi_set_drvdata(spi, indio_dev);
-
 	priv->spi = spi;
 
 	indio_dev->name = TI_TSC2046_NAME;
-- 
2.31.1


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

* Re: [PATCH] iio: adc: remove unused private data assigned with spi_set_drvdata()
  2021-05-13 11:10 [PATCH] iio: adc: remove unused private data assigned with spi_set_drvdata() Alexandru Ardelean
@ 2021-05-13 11:21 ` Alexandru Lazar
  2021-05-13 12:14   ` Alexandru Ardelean
  0 siblings, 1 reply; 5+ messages in thread
From: Alexandru Lazar @ 2021-05-13 11:21 UTC (permalink / raw)
  To: linux-iio, linux-kernel


> Some drivers were copied from drivers that fit the criteria described
> above. In any case, in order to prevent more drivers from being used as
> example (and have spi_set_drvdata() needlessly set), this change removes it
> from the IIO ADC group.

Oh yeah, I'm pretty sure that's how I ended up adding it in the max1241 
code, too. Code monkey presents humble apologies :-).

All the best,
Alex

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

* Re: [PATCH] iio: adc: remove unused private data assigned with spi_set_drvdata()
  2021-05-13 11:21 ` Alexandru Lazar
@ 2021-05-13 12:14   ` Alexandru Ardelean
  2021-05-13 14:55     ` Jonathan Cameron
  0 siblings, 1 reply; 5+ messages in thread
From: Alexandru Ardelean @ 2021-05-13 12:14 UTC (permalink / raw)
  To: Alexandru Lazar; +Cc: linux-iio, LKML

On Thu, May 13, 2021 at 3:06 PM Alexandru Lazar <alazar@startmail.com> wrote:
>
>
> > Some drivers were copied from drivers that fit the criteria described
> > above. In any case, in order to prevent more drivers from being used as
> > example (and have spi_set_drvdata() needlessly set), this change removes it
> > from the IIO ADC group.
>
> Oh yeah, I'm pretty sure that's how I ended up adding it in the max1241
> code, too. Code monkey presents humble apologies :-).

Well, I also added one in the AD9467 driver in the same manner.
So  ¯\_(ツ)_/¯

>
> All the best,
> Alex

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

* Re: [PATCH] iio: adc: remove unused private data assigned with spi_set_drvdata()
  2021-05-13 12:14   ` Alexandru Ardelean
@ 2021-05-13 14:55     ` Jonathan Cameron
  2021-06-09 20:12       ` Jonathan Cameron
  0 siblings, 1 reply; 5+ messages in thread
From: Jonathan Cameron @ 2021-05-13 14:55 UTC (permalink / raw)
  To: Alexandru Ardelean; +Cc: Alexandru Lazar, linux-iio, LKML

On Thu, 13 May 2021 15:14:57 +0300
Alexandru Ardelean <ardeleanalex@gmail.com> wrote:

> On Thu, May 13, 2021 at 3:06 PM Alexandru Lazar <alazar@startmail.com> wrote:
> >
> >  
> > > Some drivers were copied from drivers that fit the criteria described
> > > above. In any case, in order to prevent more drivers from being used as
> > > example (and have spi_set_drvdata() needlessly set), this change removes it
> > > from the IIO ADC group.  
> >
> > Oh yeah, I'm pretty sure that's how I ended up adding it in the max1241
> > code, too. Code monkey presents humble apologies :-).  
> 
> Well, I also added one in the AD9467 driver in the same manner.
> So  ¯\_(ツ)_/¯
> 
All look correct to me. I'll let this sit on the list for a few days before
picking it up.

Thanks,

Jonathan

> >
> > All the best,
> > Alex  


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

* Re: [PATCH] iio: adc: remove unused private data assigned with spi_set_drvdata()
  2021-05-13 14:55     ` Jonathan Cameron
@ 2021-06-09 20:12       ` Jonathan Cameron
  0 siblings, 0 replies; 5+ messages in thread
From: Jonathan Cameron @ 2021-06-09 20:12 UTC (permalink / raw)
  To: Alexandru Ardelean; +Cc: Alexandru Lazar, linux-iio, LKML

On Thu, 13 May 2021 15:55:52 +0100
Jonathan Cameron <jic23@kernel.org> wrote:

> On Thu, 13 May 2021 15:14:57 +0300
> Alexandru Ardelean <ardeleanalex@gmail.com> wrote:
> 
> > On Thu, May 13, 2021 at 3:06 PM Alexandru Lazar <alazar@startmail.com> wrote:  
> > >
> > >    
> > > > Some drivers were copied from drivers that fit the criteria described
> > > > above. In any case, in order to prevent more drivers from being used as
> > > > example (and have spi_set_drvdata() needlessly set), this change removes it
> > > > from the IIO ADC group.    
> > >
> > > Oh yeah, I'm pretty sure that's how I ended up adding it in the max1241
> > > code, too. Code monkey presents humble apologies :-).    
> > 
> > Well, I also added one in the AD9467 driver in the same manner.
> > So  ¯\_(ツ)_/¯
> >   
> All look correct to me. I'll let this sit on the list for a few days before
> picking it up.
Applied thanks.
> 
> Thanks,
> 
> Jonathan
> 
> > >
> > > All the best,
> > > Alex    
> 


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

end of thread, other threads:[~2021-06-09 20:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-13 11:10 [PATCH] iio: adc: remove unused private data assigned with spi_set_drvdata() Alexandru Ardelean
2021-05-13 11:21 ` Alexandru Lazar
2021-05-13 12:14   ` Alexandru Ardelean
2021-05-13 14:55     ` Jonathan Cameron
2021-06-09 20:12       ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).