staging:iio:various move default scan mask setting after ring register or remove
authorJonathan Cameron <jic23@cam.ac.uk>
Fri, 2 Sep 2011 16:14:37 +0000 (17:14 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 6 Sep 2011 23:01:59 +0000 (16:01 -0700)
The scan mask will be dynamically assigned in register, so don't
use it before that.

In adis16260 I've moved it as I know this driver has userspace code.
Same for sca3000 where it is cost free due to hardware buffer.
Can do that for the others, but in theory userspace code should always
have been checking these and setting them appropriately anyway!

V2: Clear default mask out of adis16400 as reported by Michael

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Reported-by: Michael Hennerich <michael.hennerich@analog.com>
Acked-by: Michael Hennerich <Michael.Hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/iio/accel/adis16201_ring.c
drivers/staging/iio/accel/adis16203_ring.c
drivers/staging/iio/accel/adis16204_ring.c
drivers/staging/iio/accel/adis16209_ring.c
drivers/staging/iio/accel/adis16240_ring.c
drivers/staging/iio/accel/lis3l02dq_ring.c
drivers/staging/iio/accel/sca3000_core.c
drivers/staging/iio/accel/sca3000_ring.c
drivers/staging/iio/gyro/adis16260_core.c
drivers/staging/iio/gyro/adis16260_ring.c
drivers/staging/iio/imu/adis16400_ring.c

index 4b433c53e5c5e890b1dc0b4d0e8ea2d5cffa6627..1c1f35d77c3442dd33b0c54d594d498846fe746c 100644 (file)
@@ -121,15 +121,6 @@ int adis16201_configure_ring(struct iio_dev *indio_dev)
        ring->setup_ops = &adis16201_ring_setup_ops;
        ring->owner = THIS_MODULE;
 
-       /* Set default scan mode */
-       iio_scan_mask_set(ring, ADIS16201_SCAN_SUPPLY);
-       iio_scan_mask_set(ring, ADIS16201_SCAN_ACC_X);
-       iio_scan_mask_set(ring, ADIS16201_SCAN_ACC_Y);
-       iio_scan_mask_set(ring, ADIS16201_SCAN_AUX_ADC);
-       iio_scan_mask_set(ring, ADIS16201_SCAN_TEMP);
-       iio_scan_mask_set(ring, ADIS16201_SCAN_INCLI_X);
-       iio_scan_mask_set(ring, ADIS16201_SCAN_INCLI_Y);
-
        indio_dev->pollfunc = iio_alloc_pollfunc(&iio_pollfunc_store_time,
                                                 &adis16201_trigger_handler,
                                                 IRQF_ONESHOT,
index 993e239f9426bf15bfb18621bc43ebbac01f496c..d7d692c17b4c7c87667a2d930c927f05c5803891 100644 (file)
@@ -123,13 +123,6 @@ int adis16203_configure_ring(struct iio_dev *indio_dev)
        ring->setup_ops = &adis16203_ring_setup_ops;
        ring->owner = THIS_MODULE;
 
-       /* Set default scan mode */
-       iio_scan_mask_set(ring, ADIS16203_SCAN_SUPPLY);
-       iio_scan_mask_set(ring, ADIS16203_SCAN_TEMP);
-       iio_scan_mask_set(ring, ADIS16203_SCAN_AUX_ADC);
-       iio_scan_mask_set(ring, ADIS16203_SCAN_INCLI_X);
-       iio_scan_mask_set(ring, ADIS16203_SCAN_INCLI_Y);
-
        indio_dev->pollfunc = iio_alloc_pollfunc(&iio_pollfunc_store_time,
                                                 &adis16203_trigger_handler,
                                                 IRQF_ONESHOT,
index 847f43858f50d89a458b1f81f0cab9e49a8db984..273293aa2006cdbb68d588b9aff76af223bc4e3f 100644 (file)
@@ -118,13 +118,6 @@ int adis16204_configure_ring(struct iio_dev *indio_dev)
        ring->setup_ops = &adis16204_ring_setup_ops;
        ring->owner = THIS_MODULE;
 
-       /* Set default scan mode */
-       iio_scan_mask_set(ring, ADIS16204_SCAN_SUPPLY);
-       iio_scan_mask_set(ring, ADIS16204_SCAN_ACC_X);
-       iio_scan_mask_set(ring, ADIS16204_SCAN_ACC_Y);
-       iio_scan_mask_set(ring, ADIS16204_SCAN_AUX_ADC);
-       iio_scan_mask_set(ring, ADIS16204_SCAN_TEMP);
-
        indio_dev->pollfunc = iio_alloc_pollfunc(&iio_pollfunc_store_time,
                                                 &adis16204_trigger_handler,
                                                 IRQF_ONESHOT,
index f889fe72f33af94f3394c3cc5d90054aa7c7eee7..bc654e2e477b558c7009e33ad76981dc63e14580 100644 (file)
@@ -118,16 +118,6 @@ int adis16209_configure_ring(struct iio_dev *indio_dev)
        ring->setup_ops = &adis16209_ring_setup_ops;
        ring->owner = THIS_MODULE;
 
-       /* Set default scan mode */
-       iio_scan_mask_set(ring, ADIS16209_SCAN_SUPPLY);
-       iio_scan_mask_set(ring, ADIS16209_SCAN_ACC_X);
-       iio_scan_mask_set(ring, ADIS16209_SCAN_ACC_Y);
-       iio_scan_mask_set(ring, ADIS16209_SCAN_AUX_ADC);
-       iio_scan_mask_set(ring, ADIS16209_SCAN_TEMP);
-       iio_scan_mask_set(ring, ADIS16209_SCAN_INCLI_X);
-       iio_scan_mask_set(ring, ADIS16209_SCAN_INCLI_Y);
-       iio_scan_mask_set(ring, ADIS16209_SCAN_ROT);
-
        indio_dev->pollfunc = iio_alloc_pollfunc(&iio_pollfunc_store_time,
                                                 &adis16209_trigger_handler,
                                                 IRQF_ONESHOT,
index 051ba643d3403d6ea984616a58ea67efaa5ff11e..b41e24f02a9aa56432201f336861334500fa3d58 100644 (file)
@@ -115,14 +115,6 @@ int adis16240_configure_ring(struct iio_dev *indio_dev)
        ring->setup_ops = &adis16240_ring_setup_ops;
        ring->owner = THIS_MODULE;
 
-       /* Set default scan mode */
-       iio_scan_mask_set(ring, ADIS16240_SCAN_SUPPLY);
-       iio_scan_mask_set(ring, ADIS16240_SCAN_ACC_X);
-       iio_scan_mask_set(ring, ADIS16240_SCAN_ACC_Y);
-       iio_scan_mask_set(ring, ADIS16240_SCAN_ACC_Z);
-       iio_scan_mask_set(ring, ADIS16240_SCAN_AUX_ADC);
-       iio_scan_mask_set(ring, ADIS16240_SCAN_TEMP);
-
        indio_dev->pollfunc = iio_alloc_pollfunc(&iio_pollfunc_store_time,
                                                 &adis16240_trigger_handler,
                                                 IRQF_ONESHOT,
index 5c6fe13408b1c80e6116e1ddeaf9a83c8a370ab8..d67d78394cb9a621e1239b9c0d17ee7b34d9d5ec 100644 (file)
@@ -441,11 +441,6 @@ int lis3l02dq_configure_ring(struct iio_dev *indio_dev)
        ring->setup_ops = &lis3l02dq_ring_setup_ops;
        ring->owner = THIS_MODULE;
 
-       /* Set default scan mode */
-       iio_scan_mask_set(ring, 0);
-       iio_scan_mask_set(ring, 1);
-       iio_scan_mask_set(ring, 2);
-
        /* Functions are NULL as we set handler below */
        indio_dev->pollfunc = iio_alloc_pollfunc(&iio_pollfunc_store_time,
                                                 &lis3l02dq_trigger_handler,
index 8281d66132d43b0f3df60942386f0f43253af38f..3707acc6c796cadd1bdf5c0675ee418f03580dd1 100644 (file)
@@ -1161,6 +1161,12 @@ static int __devinit sca3000_probe(struct spi_device *spi)
                                       ARRAY_SIZE(sca3000_channels));
        if (ret < 0)
                goto error_unregister_dev;
+       if (indio_dev->ring) {
+               iio_scan_mask_set(indio_dev->ring, 0);
+               iio_scan_mask_set(indio_dev->ring, 1);
+               iio_scan_mask_set(indio_dev->ring, 2);
+       }
+
        if (spi->irq && gpio_is_valid(irq_to_gpio(spi->irq)) > 0) {
                ret = request_threaded_irq(spi->irq,
                                           NULL,
index cc38521e6e2138c3566b4c214d524900f0e5b8d1..3d6dafa11e5c48875b54c4ca268fc7c6e3b89106 100644 (file)
@@ -294,10 +294,6 @@ int sca3000_configure_ring(struct iio_dev *indio_dev)
 
        indio_dev->ring->access = &sca3000_ring_access_funcs;
 
-       iio_scan_mask_set(indio_dev->ring, 0);
-       iio_scan_mask_set(indio_dev->ring, 1);
-       iio_scan_mask_set(indio_dev->ring, 2);
-
        return 0;
 }
 
index 6ea6d58fd1c282ed95084dccfebaaa732906723c..acd17e50df57d4d026337f837f6ece4b35f3751a 100644 (file)
@@ -636,7 +636,14 @@ static int __devinit adis16260_probe(struct spi_device *spi)
                printk(KERN_ERR "failed to initialize the ring\n");
                goto error_unreg_ring_funcs;
        }
-
+       if (indio_dev->ring) {
+               /* Set default scan mode */
+               iio_scan_mask_set(indio_dev->ring, ADIS16260_SCAN_SUPPLY);
+               iio_scan_mask_set(indio_dev->ring, ADIS16260_SCAN_GYRO);
+               iio_scan_mask_set(indio_dev->ring, ADIS16260_SCAN_AUX_ADC);
+               iio_scan_mask_set(indio_dev->ring, ADIS16260_SCAN_TEMP);
+               iio_scan_mask_set(indio_dev->ring, ADIS16260_SCAN_ANGL);
+       }
        if (spi->irq) {
                ret = adis16260_probe_trigger(indio_dev);
                if (ret)
index 10f8a666226b47b5f2408a36a5878718572324c2..40226f72d869965dabcee64addeb4c0dd4b38381 100644 (file)
@@ -120,13 +120,6 @@ int adis16260_configure_ring(struct iio_dev *indio_dev)
        ring->setup_ops = &adis16260_ring_setup_ops;
        ring->owner = THIS_MODULE;
 
-       /* Set default scan mode */
-       iio_scan_mask_set(ring, ADIS16260_SCAN_SUPPLY);
-       iio_scan_mask_set(ring, ADIS16260_SCAN_GYRO);
-       iio_scan_mask_set(ring, ADIS16260_SCAN_AUX_ADC);
-       iio_scan_mask_set(ring, ADIS16260_SCAN_TEMP);
-       iio_scan_mask_set(ring, ADIS16260_SCAN_ANGL);
-
        indio_dev->pollfunc = iio_alloc_pollfunc(&iio_pollfunc_store_time,
                                                 &adis16260_trigger_handler,
                                                 IRQF_ONESHOT,
index 3fc24037db29f35129fdec3f7f02548e224d92fe..d2506b1b2db0e8352eddd3276b2102acd19208b9 100644 (file)
@@ -189,9 +189,6 @@ int adis16400_configure_ring(struct iio_dev *indio_dev)
        ring->scan_timestamp = true;
        ring->setup_ops = &adis16400_ring_setup_ops;
        ring->owner = THIS_MODULE;
-       /* Set default scan mode */
-       ring->scan_mask = st->variant->default_scan_mask;
-       ring->scan_count = hweight_long(st->variant->default_scan_mask);
 
        indio_dev->pollfunc = iio_alloc_pollfunc(&iio_pollfunc_store_time,
                                                 &adis16400_trigger_handler,