diff mbox series

iio: adc: ad7292: remove unneeded spi_set_drvdata()

Message ID 20201119142720.86326-1-alexandru.ardelean@analog.com (mailing list archive)
State New
Headers show
Series iio: adc: ad7292: remove unneeded spi_set_drvdata() | expand

Commit Message

Alexandru Ardelean Nov. 19, 2020, 2:27 p.m. UTC
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(-)

Comments

Marcelo Schmitt Nov. 20, 2020, 2:21 p.m. UTC | #1
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
>
Jonathan Cameron Nov. 21, 2020, 3:16 p.m. UTC | #2
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
> >
diff mbox series

Patch

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