Commit bd94c6a8 authored by Jonathan Cameron's avatar Jonathan Cameron Committed by Greg Kroah-Hartman

staging:iio:various move default scan mask setting after ring register or remove

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: default avatarJonathan Cameron <jic23@cam.ac.uk>
Reported-by: default avatarMichael Hennerich <michael.hennerich@analog.com>
Acked-by: default avatarMichael Hennerich <Michael.Hennerich@analog.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 8310b86c
...@@ -121,15 +121,6 @@ int adis16201_configure_ring(struct iio_dev *indio_dev) ...@@ -121,15 +121,6 @@ int adis16201_configure_ring(struct iio_dev *indio_dev)
ring->setup_ops = &adis16201_ring_setup_ops; ring->setup_ops = &adis16201_ring_setup_ops;
ring->owner = THIS_MODULE; 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, indio_dev->pollfunc = iio_alloc_pollfunc(&iio_pollfunc_store_time,
&adis16201_trigger_handler, &adis16201_trigger_handler,
IRQF_ONESHOT, IRQF_ONESHOT,
......
...@@ -123,13 +123,6 @@ int adis16203_configure_ring(struct iio_dev *indio_dev) ...@@ -123,13 +123,6 @@ int adis16203_configure_ring(struct iio_dev *indio_dev)
ring->setup_ops = &adis16203_ring_setup_ops; ring->setup_ops = &adis16203_ring_setup_ops;
ring->owner = THIS_MODULE; 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, indio_dev->pollfunc = iio_alloc_pollfunc(&iio_pollfunc_store_time,
&adis16203_trigger_handler, &adis16203_trigger_handler,
IRQF_ONESHOT, IRQF_ONESHOT,
......
...@@ -118,13 +118,6 @@ int adis16204_configure_ring(struct iio_dev *indio_dev) ...@@ -118,13 +118,6 @@ int adis16204_configure_ring(struct iio_dev *indio_dev)
ring->setup_ops = &adis16204_ring_setup_ops; ring->setup_ops = &adis16204_ring_setup_ops;
ring->owner = THIS_MODULE; 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, indio_dev->pollfunc = iio_alloc_pollfunc(&iio_pollfunc_store_time,
&adis16204_trigger_handler, &adis16204_trigger_handler,
IRQF_ONESHOT, IRQF_ONESHOT,
......
...@@ -118,16 +118,6 @@ int adis16209_configure_ring(struct iio_dev *indio_dev) ...@@ -118,16 +118,6 @@ int adis16209_configure_ring(struct iio_dev *indio_dev)
ring->setup_ops = &adis16209_ring_setup_ops; ring->setup_ops = &adis16209_ring_setup_ops;
ring->owner = THIS_MODULE; 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, indio_dev->pollfunc = iio_alloc_pollfunc(&iio_pollfunc_store_time,
&adis16209_trigger_handler, &adis16209_trigger_handler,
IRQF_ONESHOT, IRQF_ONESHOT,
......
...@@ -115,14 +115,6 @@ int adis16240_configure_ring(struct iio_dev *indio_dev) ...@@ -115,14 +115,6 @@ int adis16240_configure_ring(struct iio_dev *indio_dev)
ring->setup_ops = &adis16240_ring_setup_ops; ring->setup_ops = &adis16240_ring_setup_ops;
ring->owner = THIS_MODULE; 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, indio_dev->pollfunc = iio_alloc_pollfunc(&iio_pollfunc_store_time,
&adis16240_trigger_handler, &adis16240_trigger_handler,
IRQF_ONESHOT, IRQF_ONESHOT,
......
...@@ -441,11 +441,6 @@ int lis3l02dq_configure_ring(struct iio_dev *indio_dev) ...@@ -441,11 +441,6 @@ int lis3l02dq_configure_ring(struct iio_dev *indio_dev)
ring->setup_ops = &lis3l02dq_ring_setup_ops; ring->setup_ops = &lis3l02dq_ring_setup_ops;
ring->owner = THIS_MODULE; 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 */ /* Functions are NULL as we set handler below */
indio_dev->pollfunc = iio_alloc_pollfunc(&iio_pollfunc_store_time, indio_dev->pollfunc = iio_alloc_pollfunc(&iio_pollfunc_store_time,
&lis3l02dq_trigger_handler, &lis3l02dq_trigger_handler,
......
...@@ -1161,6 +1161,12 @@ static int __devinit sca3000_probe(struct spi_device *spi) ...@@ -1161,6 +1161,12 @@ static int __devinit sca3000_probe(struct spi_device *spi)
ARRAY_SIZE(sca3000_channels)); ARRAY_SIZE(sca3000_channels));
if (ret < 0) if (ret < 0)
goto error_unregister_dev; 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) { if (spi->irq && gpio_is_valid(irq_to_gpio(spi->irq)) > 0) {
ret = request_threaded_irq(spi->irq, ret = request_threaded_irq(spi->irq,
NULL, NULL,
......
...@@ -294,10 +294,6 @@ int sca3000_configure_ring(struct iio_dev *indio_dev) ...@@ -294,10 +294,6 @@ int sca3000_configure_ring(struct iio_dev *indio_dev)
indio_dev->ring->access = &sca3000_ring_access_funcs; 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; return 0;
} }
......
...@@ -636,7 +636,14 @@ static int __devinit adis16260_probe(struct spi_device *spi) ...@@ -636,7 +636,14 @@ static int __devinit adis16260_probe(struct spi_device *spi)
printk(KERN_ERR "failed to initialize the ring\n"); printk(KERN_ERR "failed to initialize the ring\n");
goto error_unreg_ring_funcs; 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) { if (spi->irq) {
ret = adis16260_probe_trigger(indio_dev); ret = adis16260_probe_trigger(indio_dev);
if (ret) if (ret)
......
...@@ -120,13 +120,6 @@ int adis16260_configure_ring(struct iio_dev *indio_dev) ...@@ -120,13 +120,6 @@ int adis16260_configure_ring(struct iio_dev *indio_dev)
ring->setup_ops = &adis16260_ring_setup_ops; ring->setup_ops = &adis16260_ring_setup_ops;
ring->owner = THIS_MODULE; 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, indio_dev->pollfunc = iio_alloc_pollfunc(&iio_pollfunc_store_time,
&adis16260_trigger_handler, &adis16260_trigger_handler,
IRQF_ONESHOT, IRQF_ONESHOT,
......
...@@ -189,9 +189,6 @@ int adis16400_configure_ring(struct iio_dev *indio_dev) ...@@ -189,9 +189,6 @@ int adis16400_configure_ring(struct iio_dev *indio_dev)
ring->scan_timestamp = true; ring->scan_timestamp = true;
ring->setup_ops = &adis16400_ring_setup_ops; ring->setup_ops = &adis16400_ring_setup_ops;
ring->owner = THIS_MODULE; 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, indio_dev->pollfunc = iio_alloc_pollfunc(&iio_pollfunc_store_time,
&adis16400_trigger_handler, &adis16400_trigger_handler,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment