summaryrefslogtreecommitdiffstats
path: root/drivers/iio
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-02-07 08:57:00 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-02-07 08:57:00 -0800
commit81e990bbdeb77db80d7e7f0e36e159a0facfdff0 (patch)
tree0ec51a2bcf825c35d524af027237b17cff89a8f3 /drivers/iio
parent5a819ed6d4bb803ee609b4ceedd7c8efbbfa65e0 (diff)
parent8c314da583c9d5c67fe59aa8c92f94f15cb8de90 (diff)
downloadop-kernel-dev-81e990bbdeb77db80d7e7f0e36e159a0facfdff0.zip
op-kernel-dev-81e990bbdeb77db80d7e7f0e36e159a0facfdff0.tar.gz
Merge tag 'iio-fixes-for-3.14a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus
Jonathan writes: First set of IIO fixes for the 3.14 cycle. Included is the patch previously set as the fourth round for 3.13 which was to late to be appropriate. * Another endian fix (ad799x adc) due to missuse of the IIO_ST macro (which is going away very shortly) * A reversed error check in ad5933 which will make the probe fail. * A buffer overflow in the example code in the documentation. * ad799x was freeing an irq that might or might not have been requested. * tsl2563 was checking the wrong element of chan_spec for modifiers. Thus some sysfs reads would give the wrong values. * A missing dependency on HAS_IOMEM in spear_adc and lpc32xx was causing some test build failures (on s390 and perhaps elsewhere). I also have a few fixes queued up for things that went in during the 3.14 merge window which will follow as a separate pull request (to avoid rebasing my tree).
Diffstat (limited to 'drivers/iio')
-rw-r--r--drivers/iio/light/tsl2563.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/iio/light/tsl2563.c b/drivers/iio/light/tsl2563.c
index 3d81101..94daa9f 100644
--- a/drivers/iio/light/tsl2563.c
+++ b/drivers/iio/light/tsl2563.c
@@ -460,10 +460,14 @@ static int tsl2563_write_raw(struct iio_dev *indio_dev,
{
struct tsl2563_chip *chip = iio_priv(indio_dev);
- if (chan->channel == IIO_MOD_LIGHT_BOTH)
+ if (mask != IIO_CHAN_INFO_CALIBSCALE)
+ return -EINVAL;
+ if (chan->channel2 == IIO_MOD_LIGHT_BOTH)
chip->calib0 = calib_from_sysfs(val);
- else
+ else if (chan->channel2 == IIO_MOD_LIGHT_IR)
chip->calib1 = calib_from_sysfs(val);
+ else
+ return -EINVAL;
return 0;
}
@@ -472,14 +476,14 @@ static int tsl2563_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int *val,
int *val2,
- long m)
+ long mask)
{
int ret = -EINVAL;
u32 calib0, calib1;
struct tsl2563_chip *chip = iio_priv(indio_dev);
mutex_lock(&chip->lock);
- switch (m) {
+ switch (mask) {
case IIO_CHAN_INFO_RAW:
case IIO_CHAN_INFO_PROCESSED:
switch (chan->type) {
@@ -498,7 +502,7 @@ static int tsl2563_read_raw(struct iio_dev *indio_dev,
ret = tsl2563_get_adc(chip);
if (ret)
goto error_ret;
- if (chan->channel == 0)
+ if (chan->channel2 == IIO_MOD_LIGHT_BOTH)
*val = chip->data0;
else
*val = chip->data1;
@@ -510,7 +514,7 @@ static int tsl2563_read_raw(struct iio_dev *indio_dev,
break;
case IIO_CHAN_INFO_CALIBSCALE:
- if (chan->channel == 0)
+ if (chan->channel2 == IIO_MOD_LIGHT_BOTH)
*val = calib_to_sysfs(chip->calib0);
else
*val = calib_to_sysfs(chip->calib1);
OpenPOWER on IntegriCloud