staging:iio: use spi->irq valid rather than querying available modes
authorJonathan Cameron <jic23@kernel.org>
Tue, 10 Apr 2012 20:11:09 +0000 (21:11 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 10 Apr 2012 20:26:33 +0000 (13:26 -0700)
Given these drivers only try to add the trigger if a valid
irq is present it is clearer to check the same condition when
deciding whether to remove it on a later trigger.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/iio/imu/adis16400_core.c
drivers/staging/iio/meter/ade7758_core.c

index e73ad7818d85ea76c399339be5cc481aa2d32c73..a027d6d7141909ec08742f3bd37f545cdac37d6d 100644 (file)
@@ -1172,7 +1172,7 @@ static int __devinit adis16400_probe(struct spi_device *spi)
        return 0;
 
 error_remove_trigger:
-       if (indio_dev->modes & INDIO_BUFFER_TRIGGERED)
+       if (spi->irq)
                adis16400_remove_trigger(indio_dev);
 error_uninitialize_ring:
        iio_buffer_unregister(indio_dev);
index dcb20294dfe8382705d1432c00a252fc6d439500..9374d6b264b02b2b556b23cd17292e0840ed42a8 100644 (file)
@@ -800,7 +800,7 @@ static int __devinit ade7758_probe(struct spi_device *spi)
        return 0;
 
 error_remove_trigger:
-       if (indio_dev->modes & INDIO_BUFFER_TRIGGERED)
+       if (spi->irq)
                ade7758_remove_trigger(indio_dev);
 error_uninitialize_ring:
        ade7758_uninitialize_ring(indio_dev);