summaryrefslogtreecommitdiffstats
path: root/drivers/staging/iio/meter
diff options
context:
space:
mode:
authorJonathan Cameron2011-05-18 15:42:24 +0200
committerGreg Kroah-Hartman2011-05-20 01:15:03 +0200
commit5565a450248d827afa949aab157873d4b9be329e (patch)
treeef63d8173f83e685b00cdf41435575cfd34d84f2 /drivers/staging/iio/meter
parentstaging:iio:imu:adis16400 avoid allocating rx, tx, and state separately from ... (diff)
downloadkernel-qcow2-linux-5565a450248d827afa949aab157873d4b9be329e.tar.gz
kernel-qcow2-linux-5565a450248d827afa949aab157873d4b9be329e.tar.xz
kernel-qcow2-linux-5565a450248d827afa949aab157873d4b9be329e.zip
staging:iio: rationalization of different buffer implementation hooks.
1) move a generic helper function out of ring_sw. It applies to other buffers as well. 2) Get rid of a lot of left over function definitions. 3) Move all the access functions into static structures. 4) Introduce and use a static structure for the setup functions, preenable etc. Some driver conversions thanks to Michael Hennerich (pulled out of patches that would otherwise sit after this). Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/iio/meter')
-rw-r--r--drivers/staging/iio/meter/ade7758_ring.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/drivers/staging/iio/meter/ade7758_ring.c b/drivers/staging/iio/meter/ade7758_ring.c
index c8ebfd2fd9e3..564555a81191 100644
--- a/drivers/staging/iio/meter/ade7758_ring.c
+++ b/drivers/staging/iio/meter/ade7758_ring.c
@@ -83,7 +83,7 @@ static irqreturn_t ade7758_trigger_handler(int irq, void *p)
if (ring->scan_timestamp)
dat64[1] = pf->timestamp;
- ring->access.store_to(ring, (u8 *)dat64, pf->timestamp);
+ ring->access->store_to(ring, (u8 *)dat64, pf->timestamp);
iio_trigger_notify_done(st->indio_dev->trig);
@@ -118,8 +118,8 @@ static int ade7758_ring_preenable(struct iio_dev *indio_dev)
d_size += sizeof(s64) - (d_size % sizeof(s64));
}
- if (indio_dev->ring->access.set_bytes_per_datum)
- indio_dev->ring->access.set_bytes_per_datum(indio_dev->ring,
+ if (indio_dev->ring->access->set_bytes_per_datum)
+ indio_dev->ring->access->set_bytes_per_datum(indio_dev->ring,
d_size);
ade7758_write_waveform_type(&indio_dev->dev,
@@ -128,6 +128,12 @@ static int ade7758_ring_preenable(struct iio_dev *indio_dev)
return 0;
}
+static const struct iio_ring_setup_ops ade7758_ring_setup_ops = {
+ .preenable = &ade7758_ring_preenable,
+ .postenable = &iio_triggered_ring_postenable,
+ .predisable = &iio_triggered_ring_predisable,
+};
+
void ade7758_unconfigure_ring(struct iio_dev *indio_dev)
{
/* ensure that the trigger has been detached */
@@ -153,10 +159,8 @@ int ade7758_configure_ring(struct iio_dev *indio_dev)
}
/* Effectively select the ring buffer implementation */
- iio_ring_sw_register_funcs(&indio_dev->ring->access);
- indio_dev->ring->preenable = &ade7758_ring_preenable;
- indio_dev->ring->postenable = &iio_triggered_ring_postenable;
- indio_dev->ring->predisable = &iio_triggered_ring_predisable;
+ indio_dev->ring->access = &ring_sw_access_funcs;
+ indio_dev->ring->setup_ops = &ade7758_ring_setup_ops;
indio_dev->ring->owner = THIS_MODULE;
indio_dev->pollfunc = kzalloc(sizeof(*indio_dev->pollfunc), GFP_KERNEL);