diff mbox series

[08/11] staging: iio: adt7316: allow adt751x to use internal vref for all dacs

Message ID 20181212005503.28054-9-jeremyfertic@gmail.com (mailing list archive)
State New, archived
Headers show
Series staging: iio: adt7316: dac fixes | expand

Commit Message

Jeremy Fertic Dec. 12, 2018, 12:55 a.m. UTC
With adt7516/7/9, internal vref is available for dacs a and b, dacs c and
d, or all dacs. The driver doesn't currently support internal vref for all
dacs. Change the else if to an if so both bits are checked rather than
just one or the other.

Signed-off-by: Jeremy Fertic <jeremyfertic@gmail.com>
---
 drivers/staging/iio/addac/adt7316.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jonathan Cameron Dec. 16, 2018, 11:54 a.m. UTC | #1
On Tue, 11 Dec 2018 17:55:00 -0700
Jeremy Fertic <jeremyfertic@gmail.com> wrote:

> With adt7516/7/9, internal vref is available for dacs a and b, dacs c and
> d, or all dacs. The driver doesn't currently support internal vref for all
> dacs. Change the else if to an if so both bits are checked rather than
> just one or the other.
> 
> Signed-off-by: Jeremy Fertic <jeremyfertic@gmail.com>
This one is nice and separated from the earlier patches and 'obviously' right
I think.  Applied to the togreg branch of iio.git and pushed out as testing for
the autobuilders to play with it.

It's also fine to backport though given how broken the driver was before
patches that aren't, I'm not going to mark it for stable!

Thanks,

Jonathan

> ---
>  drivers/staging/iio/addac/adt7316.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/iio/addac/adt7316.c b/drivers/staging/iio/addac/adt7316.c
> index 98101a7157d2..3348fdf08f2e 100644
> --- a/drivers/staging/iio/addac/adt7316.c
> +++ b/drivers/staging/iio/addac/adt7316.c
> @@ -1081,7 +1081,7 @@ static ssize_t adt7316_store_DAC_internal_Vref(struct device *dev,
>  		ldac_config = chip->ldac_config & (~ADT7516_DAC_IN_VREF_MASK);
>  		if (data & 0x1)
>  			ldac_config |= ADT7516_DAC_AB_IN_VREF;
> -		else if (data & 0x2)
> +		if (data & 0x2)
>  			ldac_config |= ADT7516_DAC_CD_IN_VREF;
>  	} else {
>  		ret = kstrtou8(buf, 16, &data);
diff mbox series

Patch

diff --git a/drivers/staging/iio/addac/adt7316.c b/drivers/staging/iio/addac/adt7316.c
index 98101a7157d2..3348fdf08f2e 100644
--- a/drivers/staging/iio/addac/adt7316.c
+++ b/drivers/staging/iio/addac/adt7316.c
@@ -1081,7 +1081,7 @@  static ssize_t adt7316_store_DAC_internal_Vref(struct device *dev,
 		ldac_config = chip->ldac_config & (~ADT7516_DAC_IN_VREF_MASK);
 		if (data & 0x1)
 			ldac_config |= ADT7516_DAC_AB_IN_VREF;
-		else if (data & 0x2)
+		if (data & 0x2)
 			ldac_config |= ADT7516_DAC_CD_IN_VREF;
 	} else {
 		ret = kstrtou8(buf, 16, &data);