From: Jonathan Cameron Date: Fri, 2 Sep 2011 16:14:37 +0000 (+0100) Subject: staging:iio:various move default scan mask setting after ring register or remove X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=bd94c6a8a6d3499e857002b1f445162fba941029;p=openwrt%2Fstaging%2Fblogic.git 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: Jonathan Cameron Reported-by: Michael Hennerich Acked-by: Michael Hennerich Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/iio/accel/adis16201_ring.c b/drivers/staging/iio/accel/adis16201_ring.c index 4b433c53e5c5..1c1f35d77c34 100644 --- a/drivers/staging/iio/accel/adis16201_ring.c +++ b/drivers/staging/iio/accel/adis16201_ring.c @@ -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, diff --git a/drivers/staging/iio/accel/adis16203_ring.c b/drivers/staging/iio/accel/adis16203_ring.c index 993e239f9426..d7d692c17b4c 100644 --- a/drivers/staging/iio/accel/adis16203_ring.c +++ b/drivers/staging/iio/accel/adis16203_ring.c @@ -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, diff --git a/drivers/staging/iio/accel/adis16204_ring.c b/drivers/staging/iio/accel/adis16204_ring.c index 847f43858f50..273293aa2006 100644 --- a/drivers/staging/iio/accel/adis16204_ring.c +++ b/drivers/staging/iio/accel/adis16204_ring.c @@ -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, diff --git a/drivers/staging/iio/accel/adis16209_ring.c b/drivers/staging/iio/accel/adis16209_ring.c index f889fe72f33a..bc654e2e477b 100644 --- a/drivers/staging/iio/accel/adis16209_ring.c +++ b/drivers/staging/iio/accel/adis16209_ring.c @@ -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, diff --git a/drivers/staging/iio/accel/adis16240_ring.c b/drivers/staging/iio/accel/adis16240_ring.c index 051ba643d340..b41e24f02a9a 100644 --- a/drivers/staging/iio/accel/adis16240_ring.c +++ b/drivers/staging/iio/accel/adis16240_ring.c @@ -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, diff --git a/drivers/staging/iio/accel/lis3l02dq_ring.c b/drivers/staging/iio/accel/lis3l02dq_ring.c index 5c6fe13408b1..d67d78394cb9 100644 --- a/drivers/staging/iio/accel/lis3l02dq_ring.c +++ b/drivers/staging/iio/accel/lis3l02dq_ring.c @@ -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, diff --git a/drivers/staging/iio/accel/sca3000_core.c b/drivers/staging/iio/accel/sca3000_core.c index 8281d66132d4..3707acc6c796 100644 --- a/drivers/staging/iio/accel/sca3000_core.c +++ b/drivers/staging/iio/accel/sca3000_core.c @@ -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, diff --git a/drivers/staging/iio/accel/sca3000_ring.c b/drivers/staging/iio/accel/sca3000_ring.c index cc38521e6e21..3d6dafa11e5c 100644 --- a/drivers/staging/iio/accel/sca3000_ring.c +++ b/drivers/staging/iio/accel/sca3000_ring.c @@ -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; } diff --git a/drivers/staging/iio/gyro/adis16260_core.c b/drivers/staging/iio/gyro/adis16260_core.c index 6ea6d58fd1c2..acd17e50df57 100644 --- a/drivers/staging/iio/gyro/adis16260_core.c +++ b/drivers/staging/iio/gyro/adis16260_core.c @@ -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) diff --git a/drivers/staging/iio/gyro/adis16260_ring.c b/drivers/staging/iio/gyro/adis16260_ring.c index 10f8a666226b..40226f72d869 100644 --- a/drivers/staging/iio/gyro/adis16260_ring.c +++ b/drivers/staging/iio/gyro/adis16260_ring.c @@ -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, diff --git a/drivers/staging/iio/imu/adis16400_ring.c b/drivers/staging/iio/imu/adis16400_ring.c index 3fc24037db29..d2506b1b2db0 100644 --- a/drivers/staging/iio/imu/adis16400_ring.c +++ b/drivers/staging/iio/imu/adis16400_ring.c @@ -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,