linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iio: adc: ad7292: remove unneeded spi_set_drvdata()
@ 2020-11-19 14:27 Alexandru Ardelean
  2020-11-20 14:21 ` Marcelo Schmitt
  0 siblings, 1 reply; 3+ messages in thread
From: Alexandru Ardelean @ 2020-11-19 14:27 UTC (permalink / raw)
  To: linux-iio, linux-kernel; +Cc: jic23, marcelo.schmitt1, Alexandru Ardelean

This seems to have been copied from a driver that calls spi_set_drvdata()
but doesn't call spi_get_drvdata().
Setting a private object on the SPI device's object isn't necessary if it
won't be accessed.
This change removes the spi_set_drvdata() call.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
---
 drivers/iio/adc/ad7292.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/iio/adc/ad7292.c b/drivers/iio/adc/ad7292.c
index ab204e9199e9..70e33dd1c9f7 100644
--- a/drivers/iio/adc/ad7292.c
+++ b/drivers/iio/adc/ad7292.c
@@ -276,8 +276,6 @@ static int ad7292_probe(struct spi_device *spi)
 		return -EINVAL;
 	}
 
-	spi_set_drvdata(spi, indio_dev);
-
 	st->reg = devm_regulator_get_optional(&spi->dev, "vref");
 	if (!IS_ERR(st->reg)) {
 		ret = regulator_enable(st->reg);
-- 
2.17.1


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

* Re: [PATCH] iio: adc: ad7292: remove unneeded spi_set_drvdata()
  2020-11-19 14:27 [PATCH] iio: adc: ad7292: remove unneeded spi_set_drvdata() Alexandru Ardelean
@ 2020-11-20 14:21 ` Marcelo Schmitt
  2020-11-21 15:16   ` Jonathan Cameron
  0 siblings, 1 reply; 3+ messages in thread
From: Marcelo Schmitt @ 2020-11-20 14:21 UTC (permalink / raw)
  To: Alexandru Ardelean; +Cc: linux-iio, linux-kernel, jic23

LGTM.
Tested on raspberry pi kernel - rpi-5.9.y.

ad7292 was heavily based on ad7768-1. 
Maybe this might apply to ad7768-1 as well.

Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Tested-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>

On 11/19, Alexandru Ardelean wrote:
> This seems to have been copied from a driver that calls spi_set_drvdata()
> but doesn't call spi_get_drvdata().
> Setting a private object on the SPI device's object isn't necessary if it
> won't be accessed.
> This change removes the spi_set_drvdata() call.
> 
> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
> ---
>  drivers/iio/adc/ad7292.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/iio/adc/ad7292.c b/drivers/iio/adc/ad7292.c
> index ab204e9199e9..70e33dd1c9f7 100644
> --- a/drivers/iio/adc/ad7292.c
> +++ b/drivers/iio/adc/ad7292.c
> @@ -276,8 +276,6 @@ static int ad7292_probe(struct spi_device *spi)
>  		return -EINVAL;
>  	}
>  
> -	spi_set_drvdata(spi, indio_dev);
> -
>  	st->reg = devm_regulator_get_optional(&spi->dev, "vref");
>  	if (!IS_ERR(st->reg)) {
>  		ret = regulator_enable(st->reg);
> -- 
> 2.17.1
> 

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

* Re: [PATCH] iio: adc: ad7292: remove unneeded spi_set_drvdata()
  2020-11-20 14:21 ` Marcelo Schmitt
@ 2020-11-21 15:16   ` Jonathan Cameron
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2020-11-21 15:16 UTC (permalink / raw)
  To: Marcelo Schmitt; +Cc: Alexandru Ardelean, linux-iio, linux-kernel

On Fri, 20 Nov 2020 11:21:58 -0300
Marcelo Schmitt <marcelo.schmitt1@gmail.com> wrote:

> LGTM.
> Tested on raspberry pi kernel - rpi-5.9.y.
> 
> ad7292 was heavily based on ad7768-1. 
> Maybe this might apply to ad7768-1 as well.
> 
> Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
> Tested-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Thanks,

Applied to the togreg branch of iio.git and will be pushed out as testing
shortly for all the usual reasons.

Thanks,

Jonathan

> 
> On 11/19, Alexandru Ardelean wrote:
> > This seems to have been copied from a driver that calls spi_set_drvdata()
> > but doesn't call spi_get_drvdata().
> > Setting a private object on the SPI device's object isn't necessary if it
> > won't be accessed.
> > This change removes the spi_set_drvdata() call.
> > 
> > Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
> > ---
> >  drivers/iio/adc/ad7292.c | 2 --
> >  1 file changed, 2 deletions(-)
> > 
> > diff --git a/drivers/iio/adc/ad7292.c b/drivers/iio/adc/ad7292.c
> > index ab204e9199e9..70e33dd1c9f7 100644
> > --- a/drivers/iio/adc/ad7292.c
> > +++ b/drivers/iio/adc/ad7292.c
> > @@ -276,8 +276,6 @@ static int ad7292_probe(struct spi_device *spi)
> >  		return -EINVAL;
> >  	}
> >  
> > -	spi_set_drvdata(spi, indio_dev);
> > -
> >  	st->reg = devm_regulator_get_optional(&spi->dev, "vref");
> >  	if (!IS_ERR(st->reg)) {
> >  		ret = regulator_enable(st->reg);
> > -- 
> > 2.17.1
> >   


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

end of thread, other threads:[~2020-11-21 15:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-19 14:27 [PATCH] iio: adc: ad7292: remove unneeded spi_set_drvdata() Alexandru Ardelean
2020-11-20 14:21 ` Marcelo Schmitt
2020-11-21 15:16   ` 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).