staging: iio: push the main buffer chrdev down to the top level.
[deliverable/linux.git] / drivers / staging / iio / adc / ad7793.c
index 90f6c039d6c6328bfd7459b98d811f9730b3c443..ed993e3490841e0e24f20f8f425beafa7dac8a3a 100644 (file)
@@ -22,7 +22,7 @@
 #include "../ring_generic.h"
 #include "../ring_sw.h"
 #include "../trigger.h"
-#include "adc.h"
+#include "../trigger_consumer.h"
 
 #include "ad7793.h"
 
@@ -402,7 +402,7 @@ static int ad7793_ring_postdisable(struct iio_dev *indio_dev)
 static irqreturn_t ad7793_trigger_handler(int irq, void *p)
 {
        struct iio_poll_func *pf = p;
-       struct iio_dev *indio_dev = pf->private_data;
+       struct iio_dev *indio_dev = pf->indio_dev;
        struct iio_ring_buffer *ring = indio_dev->ring;
        struct ad7793_state *st = iio_priv(indio_dev);
        s64 dat64[2];
@@ -470,12 +470,6 @@ error_ret:
 
 static void ad7793_ring_cleanup(struct iio_dev *indio_dev)
 {
-       /* ensure that the trigger has been detached */
-       if (indio_dev->trig) {
-               iio_put_trigger(indio_dev->trig);
-               iio_trigger_dettach_poll_func(indio_dev->trig,
-                                             indio_dev->pollfunc);
-       }
        iio_dealloc_pollfunc(indio_dev->pollfunc);
        iio_sw_rb_free(indio_dev->ring);
 }
@@ -901,7 +895,7 @@ static int __devinit ad7793_probe(struct spi_device *spi)
        if (ret)
                goto error_unreg_ring;
 
-       ret = iio_ring_buffer_register_ex(indio_dev->ring, 0,
+       ret = iio_ring_buffer_register_ex(indio_dev, 0,
                                          indio_dev->channels,
                                          indio_dev->num_channels);
        if (ret)
@@ -914,7 +908,7 @@ static int __devinit ad7793_probe(struct spi_device *spi)
        return 0;
 
 error_uninitialize_ring:
-       iio_ring_buffer_unregister(indio_dev->ring);
+       iio_ring_buffer_unregister(indio_dev);
 error_remove_trigger:
        ad7793_remove_trigger(indio_dev);
 error_unreg_ring:
@@ -939,7 +933,7 @@ static int ad7793_remove(struct spi_device *spi)
        struct iio_dev *indio_dev = spi_get_drvdata(spi);
        struct ad7793_state *st = iio_priv(indio_dev);
 
-       iio_ring_buffer_unregister(indio_dev->ring);
+       iio_ring_buffer_unregister(indio_dev);
        ad7793_remove_trigger(indio_dev);
        ad7793_ring_cleanup(indio_dev);
 
This page took 0.033746 seconds and 5 git commands to generate.