summaryrefslogtreecommitdiff
path: root/drivers/staging/iio/accel/lis3l02dq_ring.c
diff options
context:
space:
mode:
authorJonathan Cameron <jic23@cam.ac.uk>2011-09-02 17:14:38 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2011-09-06 16:01:59 -0700
commit32b5eecab0f2d6f66f2e237e161d58d5916f8b13 (patch)
treec1acfa34fc1e402e38abda3ff0caa505fe8a48b1 /drivers/staging/iio/accel/lis3l02dq_ring.c
parentbd94c6a8a6d3499e857002b1f445162fba941029 (diff)
staging:iio: Switch the channel masks to bitmaps so as to allow for more channels.
This is as light as possible on changes to current drivers. Some drivers make assumptions that their masks fit in a single long. Given they were previously working this is clearly valid if not tidy. The max1363 is an example where there should be no such assumptions. V2: Add the new ad5933 Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk> Acked-by: Michael Hennerich <Michael.Hennerich@analog.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/iio/accel/lis3l02dq_ring.c')
-rw-r--r--drivers/staging/iio/accel/lis3l02dq_ring.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/staging/iio/accel/lis3l02dq_ring.c b/drivers/staging/iio/accel/lis3l02dq_ring.c
index d67d78394cb9..c8169338b276 100644
--- a/drivers/staging/iio/accel/lis3l02dq_ring.c
+++ b/drivers/staging/iio/accel/lis3l02dq_ring.c
@@ -61,8 +61,9 @@ ssize_t lis3l02dq_read_accel_from_ring(struct iio_ring_buffer *ring,
ret = ring->access->read_last(ring, (u8 *)data);
if (ret)
goto error_free_data;
- *val = data[bitmap_weight(&ring->scan_mask, index)];
+ *val = data[bitmap_weight(ring->scan_mask, index)];
error_free_data:
+
kfree(data);
return ret;
@@ -99,7 +100,7 @@ static int lis3l02dq_read_all(struct iio_dev *indio_dev, u8 *rx_array)
mutex_lock(&st->buf_lock);
for (i = 0; i < ARRAY_SIZE(read_all_tx_array)/4; i++)
- if (ring->scan_mask & (1 << i)) {
+ if (test_bit(i, ring->scan_mask)) {
/* lower byte */
xfers[j].tx_buf = st->tx + 2*j;
st->tx[2*j] = read_all_tx_array[i*4];