diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-07-07 17:59:07 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-07-07 17:59:07 -0700 |
commit | c1a567d31b5488f4593eae7ca215264947b355ca (patch) | |
tree | 347b8226a2e92676dc2618d8109b99aa275aa31e /drivers/iio | |
parent | 14b596c9d80bf63da3f0fcbddfd67eb62197afb4 (diff) | |
parent | cd3de83f147601356395b57a8673e9c5ff1e59d1 (diff) | |
download | op-kernel-dev-c1a567d31b5488f4593eae7ca215264947b355ca.zip op-kernel-dev-c1a567d31b5488f4593eae7ca215264947b355ca.tar.gz |
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')
-rw-r--r-- | drivers/iio/adc/ad799x.c | 8 | ||||
-rw-r--r-- | drivers/iio/inkern.c | 6 |
2 files changed, 10 insertions, 4 deletions
diff --git a/drivers/iio/adc/ad799x.c b/drivers/iio/adc/ad799x.c index 7e08c60..6cf9ee1 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, int ret; struct ad799x_state *st = iio_priv(indio_dev); + if (val < 0 || val > RES_MASK(chan->scan_type.realbits)) + return -EINVAL; + mutex_lock(&indio_dev->mlock); ret = ad799x_i2c_write16(st, ad799x_threshold_reg(chan, dir, info), - val); + val << chan->scan_type.shift); mutex_unlock(&indio_dev->mlock); return ret; @@ -451,7 +454,8 @@ static int ad799x_read_event_value(struct iio_dev *indio_dev, mutex_unlock(&indio_dev->mlock); if (ret < 0) return ret; - *val = valin; + *val = (valin >> chan->scan_type.shift) & + RES_MASK(chan->scan_type.realbits); return IIO_VAL_INT; } diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c index d833d55..c749700 100644 --- a/drivers/iio/inkern.c +++ b/drivers/iio/inkern.c @@ -183,7 +183,7 @@ static struct iio_channel *of_iio_channel_get_by_name(struct device_node *np, else if (name && index >= 0) { pr_err("ERROR: could not get IIO channel %s:%s(%i)\n", np->full_name, name ? name : "", index); - return chan; + return NULL; } /* @@ -193,8 +193,9 @@ static struct iio_channel *of_iio_channel_get_by_name(struct device_node *np, */ np = np->parent; if (np && !of_get_property(np, "io-channel-ranges", NULL)) - break; + return NULL; } + return chan; } @@ -317,6 +318,7 @@ struct iio_channel *iio_channel_get(struct device *dev, if (channel != NULL) return channel; } + return iio_channel_get_sys(name, channel_name); } EXPORT_SYMBOL_GPL(iio_channel_get); |