summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Kroah-Hartman2014-07-21 19:58:51 +0200
committerGreg Kroah-Hartman2014-07-21 19:58:51 +0200
commit1f31c3f0e1f3a272a95fa2026505a6c13c80488e (patch)
tree243a0bdae65ed14d563ece6211b402c2f056f8f3
parentLinux 3.16-rc6 (diff)
parentiio:bma180: Missing check for frequency fractional part (diff)
downloadkernel-qcow2-linux-1f31c3f0e1f3a272a95fa2026505a6c13c80488e.tar.gz
kernel-qcow2-linux-1f31c3f0e1f3a272a95fa2026505a6c13c80488e.tar.xz
kernel-qcow2-linux-1f31c3f0e1f3a272a95fa2026505a6c13c80488e.zip
Merge tag 'iio-fixes-for-3.16e' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus
Jonathan writes: Fifth set of fixes for IIO in the 3.16 cycle. One nasty one that has been around a long time and a couple of non compliant ABI fixes. * The demux code used to split out desired channels for devices that only support reading sets of channels at one time had a bug where it was building it's conversion tables against the wrong bitmap resulting in it never actually demuxing anything. This is an old bug, but will be effecting an increasing number of drivers as it is often used to avoid some fiddly code in the individual drivers. * bma180 and mma8452 weren't obeying the ABI wrt to units for acceleration. Were in G rather than m/s^2. A little input check was missing from bma180 that might lead to acceptance of incorrect values. This last one is minor but might lead to incorrect userspace code working and problems in the future.
-rw-r--r--drivers/iio/accel/bma180.c8
-rw-r--r--drivers/iio/industrialio-buffer.c2
2 files changed, 6 insertions, 4 deletions
diff --git a/drivers/iio/accel/bma180.c b/drivers/iio/accel/bma180.c
index a7e68c81f89d..a077cc86421b 100644
--- a/drivers/iio/accel/bma180.c
+++ b/drivers/iio/accel/bma180.c
@@ -68,13 +68,13 @@
/* Defaults values */
#define BMA180_DEF_PMODE 0
#define BMA180_DEF_BW 20
-#define BMA180_DEF_SCALE 250
+#define BMA180_DEF_SCALE 2452
/* Available values for sysfs */
#define BMA180_FLP_FREQ_AVAILABLE \
"10 20 40 75 150 300"
#define BMA180_SCALE_AVAILABLE \
- "0.000130 0.000190 0.000250 0.000380 0.000500 0.000990 0.001980"
+ "0.001275 0.001863 0.002452 0.003727 0.004903 0.009709 0.019417"
struct bma180_data {
struct i2c_client *client;
@@ -94,7 +94,7 @@ enum bma180_axis {
};
static int bw_table[] = { 10, 20, 40, 75, 150, 300 }; /* Hz */
-static int scale_table[] = { 130, 190, 250, 380, 500, 990, 1980 };
+static int scale_table[] = { 1275, 1863, 2452, 3727, 4903, 9709, 19417 };
static int bma180_get_acc_reg(struct bma180_data *data, enum bma180_axis axis)
{
@@ -376,6 +376,8 @@ static int bma180_write_raw(struct iio_dev *indio_dev,
mutex_unlock(&data->mutex);
return ret;
case IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY:
+ if (val2)
+ return -EINVAL;
mutex_lock(&data->mutex);
ret = bma180_set_bw(data, val);
mutex_unlock(&data->mutex);
diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c
index 36b1ae92e239..9f1a14009901 100644
--- a/drivers/iio/industrialio-buffer.c
+++ b/drivers/iio/industrialio-buffer.c
@@ -966,7 +966,7 @@ static int iio_buffer_update_demux(struct iio_dev *indio_dev,
/* Now we have the two masks, work from least sig and build up sizes */
for_each_set_bit(out_ind,
- indio_dev->active_scan_mask,
+ buffer->scan_mask,
indio_dev->masklength) {
in_ind = find_next_bit(indio_dev->active_scan_mask,
indio_dev->masklength,