Re: [PATCH v2 01/13] iio:adc:ad799x: Fix reading and writing of event values, apply shift

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 06/07/2014 05:31 PM, Peter Meerwald wrote:
last two bits of ADC and limit values are zero and should not be reported
(ad7993, ad7997); compare with read_raw()

Signed-off-by: Peter Meerwald <pmeerw@xxxxxxxxxx>
---
  drivers/iio/adc/ad799x.c | 6 ++++--
  1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/adc/ad799x.c b/drivers/iio/adc/ad799x.c
index 39b4cb4..099b830 100644
--- a/drivers/iio/adc/ad799x.c
+++ b/drivers/iio/adc/ad799x.c
@@ -429,7 +429,8 @@ static int ad799x_write_event_value(struct iio_dev *indio_dev,

  	mutex_lock(&indio_dev->mlock);
  	ret = ad799x_i2c_write16(st, ad799x_threshold_reg(chan, dir, info),
-		val);
+		(val & RES_MASK(chan->scan_type.realbits))
+			<< chan->scan_type.shift);

Rather than applying a mask to the written value and cutting off the upper bits, I'd prefer to have patch 8 (iio:adc:ad799x: Check range when writing event value) squashed into this.

Thanks,
- Lars
--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux