summaryrefslogtreecommitdiffstats
path: root/drivers/staging/iio/industrialio-buffer.c
diff options
context:
space:
mode:
authorLars-Peter Clausen2011-12-08 18:35:53 +0100
committerGreg Kroah-Hartman2011-12-08 21:17:36 +0100
commit5a2a6e1162d2c63b4bb3e6e3c867f0374e95cd1f (patch)
treef72afd7a582d9eeb009a7b6273158925e4bb5945 /drivers/staging/iio/industrialio-buffer.c
parentstaging:iio: Fix sw_ring memory corruption (diff)
downloadkernel-qcow2-linux-5a2a6e1162d2c63b4bb3e6e3c867f0374e95cd1f.tar.gz
kernel-qcow2-linux-5a2a6e1162d2c63b4bb3e6e3c867f0374e95cd1f.tar.xz
kernel-qcow2-linux-5a2a6e1162d2c63b4bb3e6e3c867f0374e95cd1f.zip
staging:iio: Fix scan mask update
When updating the scan mask we have to check the actual scan mask for if the channel is already enabled, not the matching scan mask from the available scan masks. The bit will already be set there and as a result the actual scan mask will not get updated and the channel stays disabled. Also fix the return value of iio_scan_el_store which would return 1 instead of the number of bytes written if the channel was already active in the scan mask. Acked-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/iio/industrialio-buffer.c')
-rw-r--r--drivers/staging/iio/industrialio-buffer.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/drivers/staging/iio/industrialio-buffer.c b/drivers/staging/iio/industrialio-buffer.c
index b46ae6a2424f..24c6aa4d82b9 100644
--- a/drivers/staging/iio/industrialio-buffer.c
+++ b/drivers/staging/iio/industrialio-buffer.c
@@ -174,7 +174,7 @@ static ssize_t iio_scan_el_store(struct device *dev,
error_ret:
mutex_unlock(&indio_dev->mlock);
- return ret ? ret : len;
+ return ret < 0 ? ret : len;
}
@@ -625,16 +625,8 @@ int iio_scan_mask_query(struct iio_buffer *buffer, int bit)
if (!buffer->scan_mask)
return 0;
- if (indio_dev->available_scan_masks)
- mask = iio_scan_mask_match(indio_dev->available_scan_masks,
- indio_dev->masklength,
- buffer->scan_mask);
- else
- mask = buffer->scan_mask;
- if (!mask)
- return 0;
- return test_bit(bit, mask);
+ return test_bit(bit, buffer->scan_mask);
};
EXPORT_SYMBOL_GPL(iio_scan_mask_query);