summaryrefslogtreecommitdiff
path: root/drivers/staging/iio/imu
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/imu
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/imu')
-rw-r--r--drivers/staging/iio/imu/adis16400_ring.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/staging/iio/imu/adis16400_ring.c b/drivers/staging/iio/imu/adis16400_ring.c
index d2506b1b2db..af25697dab9 100644
--- a/drivers/staging/iio/imu/adis16400_ring.c
+++ b/drivers/staging/iio/imu/adis16400_ring.c
@@ -85,7 +85,7 @@ static int adis16350_spi_read_all(struct device *dev, u8 *rx)
return -ENOMEM;
for (i = 0; i < ARRAY_SIZE(read_all_tx_array); i++)
- if (indio_dev->ring->scan_mask & (1 << i)) {
+ if (test_bit(i, indio_dev->ring->scan_mask)) {
xfers[j].tx_buf = &read_all_tx_array[i];
xfers[j].bits_per_word = 16;
xfers[j].len = 2;
@@ -117,7 +117,8 @@ static irqreturn_t adis16400_trigger_handler(int irq, void *p)
int i = 0, j, ret = 0;
s16 *data;
size_t datasize = ring->access->get_bytes_per_datum(ring);
- unsigned long mask = ring->scan_mask;
+ /* Asumption that long is enough for maximum channels */
+ unsigned long mask = *ring->scan_mask;
data = kmalloc(datasize , GFP_KERNEL);
if (data == NULL) {