diff options
author | Manuel Stahl <manuel.stahl@iis.fraunhofer.de> | 2010-08-31 09:32:52 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-08-31 18:42:02 (GMT) |
commit | bf32963cbeb5d34fa32a4c1eeed1163ab1b4501c (patch) | |
tree | 221c5e12d26142d6b8b5a3cfff844c9ed9ad3899 /drivers/staging/iio/gyro/adis16260_ring.c | |
parent | 07e6229e42e4d679cdbaada8f7966491c69710e7 (diff) | |
download | linux-fsl-qoriq-bf32963cbeb5d34fa32a4c1eeed1163ab1b4501c.tar.xz |
staging: iio move scan_elements into ring buffer
tested with sca3000, adis16400
Signed-off-by: Manuel Stahl <manuel.stahl@iis.fraunhofer.de>
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/iio/gyro/adis16260_ring.c')
-rw-r--r-- | drivers/staging/iio/gyro/adis16260_ring.c | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/drivers/staging/iio/gyro/adis16260_ring.c b/drivers/staging/iio/gyro/adis16260_ring.c index 055d5e8..0334860 100644 --- a/drivers/staging/iio/gyro/adis16260_ring.c +++ b/drivers/staging/iio/gyro/adis16260_ring.c @@ -110,11 +110,11 @@ static void adis16260_trigger_bh_to_ring(struct work_struct *work_s) struct adis16260_state *st = container_of(work_s, struct adis16260_state, work_trigger_to_ring); + struct iio_ring_buffer *ring = st->indio_dev->ring; int i = 0; s16 *data; - size_t datasize = st->indio_dev - ->ring->access.get_bytes_per_datum(st->indio_dev->ring); + size_t datasize = ring->access.get_bytes_per_datum(ring); data = kmalloc(datasize , GFP_KERNEL); if (data == NULL) { @@ -122,17 +122,17 @@ static void adis16260_trigger_bh_to_ring(struct work_struct *work_s) return; } - if (st->indio_dev->scan_count) + if (ring->scan_count) if (adis16260_read_ring_data(&st->indio_dev->dev, st->rx) >= 0) - for (; i < st->indio_dev->scan_count; i++) + for (; i < ring->scan_count; i++) data[i] = be16_to_cpup( (__be16 *)&(st->rx[i*2])); /* Guaranteed to be aligned with 8 byte boundary */ - if (st->indio_dev->scan_timestamp) + if (ring->scan_timestamp) *((s64 *)(data + ((i + 3)/4)*4)) = st->last_timestamp; - st->indio_dev->ring->access.store_to(st->indio_dev->ring, + ring->access.store_to(ring, (u8 *)data, st->last_timestamp); @@ -154,16 +154,6 @@ int adis16260_configure_ring(struct iio_dev *indio_dev) struct adis16260_state *st = indio_dev->dev_data; struct iio_ring_buffer *ring; INIT_WORK(&st->work_trigger_to_ring, adis16260_trigger_bh_to_ring); - /* Set default scan mode */ - - iio_scan_mask_set(indio_dev, iio_scan_el_supply.number); - iio_scan_mask_set(indio_dev, iio_scan_el_gyro.number); - iio_scan_mask_set(indio_dev, iio_scan_el_aux_adc.number); - iio_scan_mask_set(indio_dev, iio_scan_el_temp.number); - iio_scan_mask_set(indio_dev, iio_scan_el_angl.number); - indio_dev->scan_timestamp = true; - - indio_dev->scan_el_attrs = &adis16260_scan_el_group; ring = iio_sw_rb_allocate(indio_dev); if (!ring) { @@ -174,11 +164,20 @@ int adis16260_configure_ring(struct iio_dev *indio_dev) /* Effectively select the ring buffer implementation */ iio_ring_sw_register_funcs(&ring->access); ring->bpe = 2; + ring->scan_el_attrs = &adis16260_scan_el_group; + ring->scan_timestamp = true; ring->preenable = &iio_sw_ring_preenable; ring->postenable = &iio_triggered_ring_postenable; ring->predisable = &iio_triggered_ring_predisable; ring->owner = THIS_MODULE; + /* Set default scan mode */ + iio_scan_mask_set(ring, iio_scan_el_supply.number); + iio_scan_mask_set(ring, iio_scan_el_gyro.number); + iio_scan_mask_set(ring, iio_scan_el_aux_adc.number); + iio_scan_mask_set(ring, iio_scan_el_temp.number); + iio_scan_mask_set(ring, iio_scan_el_angl.number); + ret = iio_alloc_pollfunc(indio_dev, NULL, &adis16260_poll_func_th); if (ret) goto error_iio_sw_rb_free; |