diff options
Diffstat (limited to 'drivers/staging/iio/accel/adis16240_ring.c')
-rw-r--r-- | drivers/staging/iio/accel/adis16240_ring.c | 40 |
1 files changed, 12 insertions, 28 deletions
diff --git a/drivers/staging/iio/accel/adis16240_ring.c b/drivers/staging/iio/accel/adis16240_ring.c index c812a34dacaf..34f1e7e6a56f 100644 --- a/drivers/staging/iio/accel/adis16240_ring.c +++ b/drivers/staging/iio/accel/adis16240_ring.c @@ -1,20 +1,12 @@ #include <linux/interrupt.h> -#include <linux/irq.h> -#include <linux/gpio.h> -#include <linux/workqueue.h> #include <linux/mutex.h> -#include <linux/device.h> #include <linux/kernel.h> #include <linux/spi/spi.h> #include <linux/slab.h> -#include <linux/sysfs.h> -#include <linux/list.h> #include "../iio.h" -#include "../sysfs.h" #include "../ring_sw.h" -#include "accel.h" -#include "../trigger.h" +#include "../trigger_consumer.h" #include "adis16240.h" /** @@ -62,9 +54,9 @@ static int adis16240_read_ring_data(struct device *dev, u8 *rx) static irqreturn_t adis16240_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 adis16240_state *st = iio_priv(indio_dev); - struct iio_ring_buffer *ring = indio_dev->ring; + struct iio_buffer *ring = indio_dev->buffer; int i = 0; s16 *data; @@ -96,26 +88,26 @@ static irqreturn_t adis16240_trigger_handler(int irq, void *p) void adis16240_unconfigure_ring(struct iio_dev *indio_dev) { iio_dealloc_pollfunc(indio_dev->pollfunc); - iio_sw_rb_free(indio_dev->ring); + iio_sw_rb_free(indio_dev->buffer); } -static const struct iio_ring_setup_ops adis16240_ring_setup_ops = { - .preenable = &iio_sw_ring_preenable, - .postenable = &iio_triggered_ring_postenable, - .predisable = &iio_triggered_ring_predisable, +static const struct iio_buffer_setup_ops adis16240_ring_setup_ops = { + .preenable = &iio_sw_buffer_preenable, + .postenable = &iio_triggered_buffer_postenable, + .predisable = &iio_triggered_buffer_predisable, }; int adis16240_configure_ring(struct iio_dev *indio_dev) { int ret = 0; - struct iio_ring_buffer *ring; + struct iio_buffer *ring; ring = iio_sw_rb_allocate(indio_dev); if (!ring) { ret = -ENOMEM; return ret; } - indio_dev->ring = ring; + indio_dev->buffer = ring; /* Effectively select the ring buffer implementation */ ring->access = &ring_sw_access_funcs; ring->bpe = 2; @@ -123,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, @@ -143,10 +127,10 @@ int adis16240_configure_ring(struct iio_dev *indio_dev) goto error_iio_sw_rb_free; } - indio_dev->modes |= INDIO_RING_TRIGGERED; + indio_dev->modes |= INDIO_BUFFER_TRIGGERED; return 0; error_iio_sw_rb_free: - iio_sw_rb_free(indio_dev->ring); + iio_sw_rb_free(indio_dev->buffer); return ret; } |