diff mbox series

[02/11] staging: iio: adt7316: invert the logic of the check for an ldac pin

Message ID 20181212005503.28054-3-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:54 a.m. UTC
ADT7316_DA_EN_VIA_DAC_LDCA is set when the dac and ldac registers are being
used to update the dacs instead of the ldac pin. ADT7516_SEL_AIN3 is an adc
input that shares the ldac pin. Only set these bits if an ldac pin is not
being used.

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

Comments

Dan Carpenter Dec. 12, 2018, 8:19 a.m. UTC | #1
On Tue, Dec 11, 2018 at 05:54:54PM -0700, Jeremy Fertic wrote:
> ADT7316_DA_EN_VIA_DAC_LDCA is set when the dac and ldac registers are being
> used to update the dacs instead of the ldac pin. ADT7516_SEL_AIN3 is an adc
> input that shares the ldac pin. Only set these bits if an ldac pin is not
> being used.
> 
> Signed-off-by: Jeremy Fertic <jeremyfertic@gmail.com>

Huh...  This bug has always been there...

Fixes: 35f6b6b86ede ("staging: iio: new ADT7316/7/8 and ADT7516/7/9 driver")

regards,
dan carpenter
Jeremy Fertic Dec. 13, 2018, 10:06 p.m. UTC | #2
On Wed, Dec 12, 2018 at 11:19:49AM +0300, Dan Carpenter wrote:
> On Tue, Dec 11, 2018 at 05:54:54PM -0700, Jeremy Fertic wrote:
> > ADT7316_DA_EN_VIA_DAC_LDCA is set when the dac and ldac registers are being
> > used to update the dacs instead of the ldac pin. ADT7516_SEL_AIN3 is an adc
> > input that shares the ldac pin. Only set these bits if an ldac pin is not
> > being used.
> > 
> > Signed-off-by: Jeremy Fertic <jeremyfertic@gmail.com>
> 
> Huh...  This bug has always been there...
> 
> Fixes: 35f6b6b86ede ("staging: iio: new ADT7316/7/8 and ADT7516/7/9 driver")
> 
> regards,
> dan carpenter
> 

Should I include this Fixes tag in v2? I wasn't sure how important this was
in staging. I think most of the patches in this series fix bugs that date
back to the introduction of the driver.
Dan Carpenter Dec. 14, 2018, 6:18 a.m. UTC | #3
On Thu, Dec 13, 2018 at 03:06:29PM -0700, Jeremy Fertic wrote:
> On Wed, Dec 12, 2018 at 11:19:49AM +0300, Dan Carpenter wrote:
> > On Tue, Dec 11, 2018 at 05:54:54PM -0700, Jeremy Fertic wrote:
> > > ADT7316_DA_EN_VIA_DAC_LDCA is set when the dac and ldac registers are being
> > > used to update the dacs instead of the ldac pin. ADT7516_SEL_AIN3 is an adc
> > > input that shares the ldac pin. Only set these bits if an ldac pin is not
> > > being used.
> > > 
> > > Signed-off-by: Jeremy Fertic <jeremyfertic@gmail.com>
> > 
> > Huh...  This bug has always been there...
> > 
> > Fixes: 35f6b6b86ede ("staging: iio: new ADT7316/7/8 and ADT7516/7/9 driver")
> > 
> > regards,
> > dan carpenter
> > 
> 
> Should I include this Fixes tag in v2? I wasn't sure how important this was
> in staging. I think most of the patches in this series fix bugs that date
> back to the introduction of the driver.

I was just curious to see if it was a cleanup which introduced the
inverted if statement.

I think the Fixes tag is always useful.  For example, it would be
interesting to do some data mining to see how many bugs drivers
normally have when they're first merged.

regards,
dan carpenter
Jonathan Cameron Dec. 16, 2018, 11:23 a.m. UTC | #4
On Fri, 14 Dec 2018 09:18:20 +0300
Dan Carpenter <dan.carpenter@oracle.com> wrote:

> On Thu, Dec 13, 2018 at 03:06:29PM -0700, Jeremy Fertic wrote:
> > On Wed, Dec 12, 2018 at 11:19:49AM +0300, Dan Carpenter wrote:  
> > > On Tue, Dec 11, 2018 at 05:54:54PM -0700, Jeremy Fertic wrote:  
> > > > ADT7316_DA_EN_VIA_DAC_LDCA is set when the dac and ldac registers are being
> > > > used to update the dacs instead of the ldac pin. ADT7516_SEL_AIN3 is an adc
> > > > input that shares the ldac pin. Only set these bits if an ldac pin is not
> > > > being used.
> > > > 
> > > > Signed-off-by: Jeremy Fertic <jeremyfertic@gmail.com>  
> > > 
> > > Huh...  This bug has always been there...
> > > 
> > > Fixes: 35f6b6b86ede ("staging: iio: new ADT7316/7/8 and ADT7516/7/9 driver")
> > > 
> > > regards,
> > > dan carpenter
> > >   
> > 
> > Should I include this Fixes tag in v2? I wasn't sure how important this was
> > in staging. I think most of the patches in this series fix bugs that date
> > back to the introduction of the driver.  
> 
> I was just curious to see if it was a cleanup which introduced the
> inverted if statement.
> 
> I think the Fixes tag is always useful.  For example, it would be
> interesting to do some data mining to see how many bugs drivers
> normally have when they're first merged.
> 
Absolutely agreed. It's useful information even if we don't plan on
backporting.  Note that some staging fixes do get backported but
I'm adding a note to most things on this driver to say don't bother!

It's too far from 'good'.  Great to have multiple people working on
sorting that though!

If you and Shreeya could review each others patches that would be
cool.  I do have one of these, but I'm usually too lazy to actually
dig it out to test if there are others who are working with it
more normally!

Jonathan

> regards,
> dan carpenter
diff mbox series

Patch

diff --git a/drivers/staging/iio/addac/adt7316.c b/drivers/staging/iio/addac/adt7316.c
index 1fa4a4c2b4f3..e5e1f9d6357f 100644
--- a/drivers/staging/iio/addac/adt7316.c
+++ b/drivers/staging/iio/addac/adt7316.c
@@ -2130,7 +2130,7 @@  int adt7316_probe(struct device *dev, struct adt7316_bus *bus,
 		return ret;
 	}
 
-	if (chip->ldac_pin) {
+	if (!chip->ldac_pin) {
 		chip->config3 |= ADT7316_DA_EN_VIA_DAC_LDCA;
 		if ((chip->id & ID_FAMILY_MASK) == ID_ADT75XX)
 			chip->config1 |= ADT7516_SEL_AIN3;