diff mbox series

[v4,2/2] staging: iio: ad7780: remove unnecessary stashed voltage value

Message ID 3920d49d888f63b600a4d2f2600921ed2900a470.1541444377.git.renatogeh@gmail.com (mailing list archive)
State New, archived
Headers show
Series staging: iio: ad7780: correct driver read | expand

Commit Message

Renato Lui Geh Nov. 5, 2018, 7:16 p.m. UTC
This patch removes the unnecessary field int_vref_mv in ad7780_state
referring to the device's voltage.

Signed-off-by: Renato Lui Geh <renatogeh@gmail.com>
---
Changes in v3:
	- removed unnecessary int_vref_mv from ad7780_state
Changes in v4:
	- removed voltage reading on probe

 drivers/staging/iio/adc/ad7780.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

Comments

Alexandru Ardelean Nov. 6, 2018, 9:25 a.m. UTC | #1
On Mon, 2018-11-05 at 17:16 -0200, Renato Lui Geh wrote:
> This patch removes the unnecessary field int_vref_mv in ad7780_state
> referring to the device's voltage.
> 

Looks good from my side.

Alex

> Signed-off-by: Renato Lui Geh <renatogeh@gmail.com>
> ---
> Changes in v3:
> 	- removed unnecessary int_vref_mv from ad7780_state
> Changes in v4:
> 	- removed voltage reading on probe
> 
>  drivers/staging/iio/adc/ad7780.c | 9 +--------
>  1 file changed, 1 insertion(+), 8 deletions(-)
> 
> diff --git a/drivers/staging/iio/adc/ad7780.c
> b/drivers/staging/iio/adc/ad7780.c
> index c7cb05cedbbc..52a914360574 100644
> --- a/drivers/staging/iio/adc/ad7780.c
> +++ b/drivers/staging/iio/adc/ad7780.c
> @@ -42,7 +42,6 @@ struct ad7780_state {
>  	struct regulator		*reg;
>  	struct gpio_desc		*powerdown_gpio;
>  	unsigned int	gain;
> -	u16				int_vref_mv;
>  
>  	struct ad_sigma_delta sd;
>  };
> @@ -165,7 +164,7 @@ static int ad7780_probe(struct spi_device *spi)
>  {
>  	struct ad7780_state *st;
>  	struct iio_dev *indio_dev;
> -	int ret, voltage_uv = 0;
> +	int ret;
>  
>  	indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st));
>  	if (!indio_dev)
> @@ -185,16 +184,10 @@ static int ad7780_probe(struct spi_device *spi)
>  		dev_err(&spi->dev, "Failed to enable specified AVdd
> supply\n");
>  		return ret;
>  	}
> -	voltage_uv = regulator_get_voltage(st->reg);
>  
>  	st->chip_info =
>  		&ad7780_chip_info_tbl[spi_get_device_id(spi)->driver_data];
>  
> -	if (voltage_uv)
> -		st->int_vref_mv = voltage_uv / 1000;
> -	else
> -		dev_warn(&spi->dev, "Reference voltage unspecified\n");
> -
>  	spi_set_drvdata(spi, indio_dev);
>  
>  	indio_dev->dev.parent = &spi->dev;
Jonathan Cameron Nov. 11, 2018, 2:31 p.m. UTC | #2
On Tue, 6 Nov 2018 09:25:27 +0000
"Ardelean, Alexandru" <alexandru.Ardelean@analog.com> wrote:

> On Mon, 2018-11-05 at 17:16 -0200, Renato Lui Geh wrote:
> > This patch removes the unnecessary field int_vref_mv in ad7780_state
> > referring to the device's voltage.
> >   
> 
> Looks good from my side.
Applied to the togreg branch of iio.git and pushed out as testing
for the autobuilders to play with it.

Thanks,

Jonathan

> 
> Alex
> 
> > Signed-off-by: Renato Lui Geh <renatogeh@gmail.com>
> > ---
> > Changes in v3:
> > 	- removed unnecessary int_vref_mv from ad7780_state
> > Changes in v4:
> > 	- removed voltage reading on probe
> > 
> >  drivers/staging/iio/adc/ad7780.c | 9 +--------
> >  1 file changed, 1 insertion(+), 8 deletions(-)
> > 
> > diff --git a/drivers/staging/iio/adc/ad7780.c
> > b/drivers/staging/iio/adc/ad7780.c
> > index c7cb05cedbbc..52a914360574 100644
> > --- a/drivers/staging/iio/adc/ad7780.c
> > +++ b/drivers/staging/iio/adc/ad7780.c
> > @@ -42,7 +42,6 @@ struct ad7780_state {
> >  	struct regulator		*reg;
> >  	struct gpio_desc		*powerdown_gpio;
> >  	unsigned int	gain;
> > -	u16				int_vref_mv;
> >  
> >  	struct ad_sigma_delta sd;
> >  };
> > @@ -165,7 +164,7 @@ static int ad7780_probe(struct spi_device *spi)
> >  {
> >  	struct ad7780_state *st;
> >  	struct iio_dev *indio_dev;
> > -	int ret, voltage_uv = 0;
> > +	int ret;
> >  
> >  	indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st));
> >  	if (!indio_dev)
> > @@ -185,16 +184,10 @@ static int ad7780_probe(struct spi_device *spi)
> >  		dev_err(&spi->dev, "Failed to enable specified AVdd
> > supply\n");
> >  		return ret;
> >  	}
> > -	voltage_uv = regulator_get_voltage(st->reg);
> >  
> >  	st->chip_info =
> >  		&ad7780_chip_info_tbl[spi_get_device_id(spi)->driver_data];
> >  
> > -	if (voltage_uv)
> > -		st->int_vref_mv = voltage_uv / 1000;
> > -	else
> > -		dev_warn(&spi->dev, "Reference voltage unspecified\n");
> > -
> >  	spi_set_drvdata(spi, indio_dev);
> >  
> >  	indio_dev->dev.parent = &spi->dev;
diff mbox series

Patch

diff --git a/drivers/staging/iio/adc/ad7780.c b/drivers/staging/iio/adc/ad7780.c
index c7cb05cedbbc..52a914360574 100644
--- a/drivers/staging/iio/adc/ad7780.c
+++ b/drivers/staging/iio/adc/ad7780.c
@@ -42,7 +42,6 @@  struct ad7780_state {
 	struct regulator		*reg;
 	struct gpio_desc		*powerdown_gpio;
 	unsigned int	gain;
-	u16				int_vref_mv;
 
 	struct ad_sigma_delta sd;
 };
@@ -165,7 +164,7 @@  static int ad7780_probe(struct spi_device *spi)
 {
 	struct ad7780_state *st;
 	struct iio_dev *indio_dev;
-	int ret, voltage_uv = 0;
+	int ret;
 
 	indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st));
 	if (!indio_dev)
@@ -185,16 +184,10 @@  static int ad7780_probe(struct spi_device *spi)
 		dev_err(&spi->dev, "Failed to enable specified AVdd supply\n");
 		return ret;
 	}
-	voltage_uv = regulator_get_voltage(st->reg);
 
 	st->chip_info =
 		&ad7780_chip_info_tbl[spi_get_device_id(spi)->driver_data];
 
-	if (voltage_uv)
-		st->int_vref_mv = voltage_uv / 1000;
-	else
-		dev_warn(&spi->dev, "Reference voltage unspecified\n");
-
 	spi_set_drvdata(spi, indio_dev);
 
 	indio_dev->dev.parent = &spi->dev;