diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-07-07 20:59:07 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-07-07 20:59:07 -0400 |
commit | c1a567d31b5488f4593eae7ca215264947b355ca (patch) | |
tree | 347b8226a2e92676dc2618d8109b99aa275aa31e /drivers/iio/adc | |
parent | 14b596c9d80bf63da3f0fcbddfd67eb62197afb4 (diff) | |
parent | cd3de83f147601356395b57a8673e9c5ff1e59d1 (diff) |
Merge 3.16-rc4 into staging-next
We want the staging tree fixes in here as well.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/iio/adc')
-rw-r--r-- | drivers/iio/adc/ad799x.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/iio/adc/ad799x.c b/drivers/iio/adc/ad799x.c index 7e08c601f66e..6cf9ee18a216 100644 --- a/drivers/iio/adc/ad799x.c +++ b/drivers/iio/adc/ad799x.c | |||
@@ -426,9 +426,12 @@ static int ad799x_write_event_value(struct iio_dev *indio_dev, | |||
426 | int ret; | 426 | int ret; |
427 | struct ad799x_state *st = iio_priv(indio_dev); | 427 | struct ad799x_state *st = iio_priv(indio_dev); |
428 | 428 | ||
429 | if (val < 0 || val > RES_MASK(chan->scan_type.realbits)) | ||
430 | return -EINVAL; | ||
431 | |||
429 | mutex_lock(&indio_dev->mlock); | 432 | mutex_lock(&indio_dev->mlock); |
430 | ret = ad799x_i2c_write16(st, ad799x_threshold_reg(chan, dir, info), | 433 | ret = ad799x_i2c_write16(st, ad799x_threshold_reg(chan, dir, info), |
431 | val); | 434 | val << chan->scan_type.shift); |
432 | mutex_unlock(&indio_dev->mlock); | 435 | mutex_unlock(&indio_dev->mlock); |
433 | 436 | ||
434 | return ret; | 437 | return ret; |
@@ -451,7 +454,8 @@ static int ad799x_read_event_value(struct iio_dev *indio_dev, | |||
451 | mutex_unlock(&indio_dev->mlock); | 454 | mutex_unlock(&indio_dev->mlock); |
452 | if (ret < 0) | 455 | if (ret < 0) |
453 | return ret; | 456 | return ret; |
454 | *val = valin; | 457 | *val = (valin >> chan->scan_type.shift) & |
458 | RES_MASK(chan->scan_type.realbits); | ||
455 | 459 | ||
456 | return IIO_VAL_INT; | 460 | return IIO_VAL_INT; |
457 | } | 461 | } |