summaryrefslogtreecommitdiffstats
path: root/drivers/staging/iio/ring_generic.h
diff options
context:
space:
mode:
authorJonathan Cameron <jic23@cam.ac.uk>2011-05-18 14:42:24 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2011-05-19 16:15:03 -0700
commit5565a450248d827afa949aab157873d4b9be329e (patch)
treeef63d8173f83e685b00cdf41435575cfd34d84f2 /drivers/staging/iio/ring_generic.h
parent38d15f06f942306050a063abd111467d39c5cc37 (diff)
downloadop-kernel-dev-5565a450248d827afa949aab157873d4b9be329e.zip
op-kernel-dev-5565a450248d827afa949aab157873d4b9be329e.tar.gz
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/ring_generic.h')
-rw-r--r--drivers/staging/iio/ring_generic.h18
1 files changed, 12 insertions, 6 deletions
diff --git a/drivers/staging/iio/ring_generic.h b/drivers/staging/iio/ring_generic.h
index 15d15a4..3349676 100644
--- a/drivers/staging/iio/ring_generic.h
+++ b/drivers/staging/iio/ring_generic.h
@@ -64,6 +64,13 @@ struct iio_ring_access_funcs {
int (*enable)(struct iio_ring_buffer *ring);
};
+struct iio_ring_setup_ops {
+ int (*preenable)(struct iio_dev *);
+ int (*postenable)(struct iio_dev *);
+ int (*predisable)(struct iio_dev *);
+ int (*postdisable)(struct iio_dev *);
+};
+
/**
* struct iio_ring_buffer - general ring buffer structure
* @dev: ring buffer device struct
@@ -101,12 +108,8 @@ struct iio_ring_buffer {
u32 scan_mask;
bool scan_timestamp;
struct iio_handler access_handler;
- struct iio_ring_access_funcs access;
- int (*preenable)(struct iio_dev *);
- int (*postenable)(struct iio_dev *);
- int (*predisable)(struct iio_dev *);
- int (*postdisable)(struct iio_dev *);
-
+ const struct iio_ring_access_funcs *access;
+ const struct iio_ring_setup_ops *setup_ops;
struct list_head scan_el_dev_attr_list;
wait_queue_head_t pollq;
@@ -349,6 +352,9 @@ ssize_t iio_show_ring_enable(struct device *dev,
#define IIO_RING_ENABLE_ATTR DEVICE_ATTR(enable, S_IRUGO | S_IWUSR, \
iio_show_ring_enable, \
iio_store_ring_enable)
+
+int iio_sw_ring_preenable(struct iio_dev *indio_dev);
+
#else /* CONFIG_IIO_RING_BUFFER */
static inline int iio_ring_buffer_register(struct iio_ring_buffer *ring, int id)
{
OpenPOWER on IntegriCloud