diff options
author | Jonathan Cameron | 2011-05-18 15:42:24 +0200 |
---|---|---|
committer | Greg Kroah-Hartman | 2011-05-20 01:15:03 +0200 |
commit | 5565a450248d827afa949aab157873d4b9be329e (patch) | |
tree | ef63d8173f83e685b00cdf41435575cfd34d84f2 /drivers/staging/iio/kfifo_buf.h | |
parent | staging:iio:imu:adis16400 avoid allocating rx, tx, and state separately from ... (diff) | |
download | kernel-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/kfifo_buf.h')
-rw-r--r-- | drivers/staging/iio/kfifo_buf.h | 39 |
1 files changed, 1 insertions, 38 deletions
diff --git a/drivers/staging/iio/kfifo_buf.h b/drivers/staging/iio/kfifo_buf.h index eb337a47dd64..aac30539b2c6 100644 --- a/drivers/staging/iio/kfifo_buf.h +++ b/drivers/staging/iio/kfifo_buf.h @@ -11,44 +11,7 @@ struct iio_kfifo { struct mutex use_lock; }; -#define iio_to_kfifo(r) container_of(r, struct iio_kfifo, ring) - -int iio_create_kfifo(struct iio_ring_buffer **r); -int iio_init_kfifo(struct iio_ring_buffer *r, struct iio_dev *indio_dev); -void iio_exit_kfifo(struct iio_ring_buffer *r); -void iio_free_kfifo(struct iio_ring_buffer *r); -void iio_mark_kfifo_in_use(struct iio_ring_buffer *r); -void iio_unmark_kfifo_in_use(struct iio_ring_buffer *r); - -int iio_store_to_kfifo(struct iio_ring_buffer *r, u8 *data, s64 timestamp); -int iio_read_first_n_kfifo(struct iio_ring_buffer *r, - size_t n, - char __user *buf); - -int iio_request_update_kfifo(struct iio_ring_buffer *r); -int iio_mark_update_needed_kfifo(struct iio_ring_buffer *r); - -int iio_get_bytes_per_datum_kfifo(struct iio_ring_buffer *r); -int iio_set_bytes_per_datum_kfifo(struct iio_ring_buffer *r, size_t bpd); -int iio_get_length_kfifo(struct iio_ring_buffer *r); -int iio_set_length_kfifo(struct iio_ring_buffer *r, int length); - -static inline void iio_kfifo_register_funcs(struct iio_ring_access_funcs *ra) -{ - ra->mark_in_use = &iio_mark_kfifo_in_use; - ra->unmark_in_use = &iio_unmark_kfifo_in_use; - - ra->store_to = &iio_store_to_kfifo; - ra->read_first_n = &iio_read_first_n_kfifo; - - ra->mark_param_change = &iio_mark_update_needed_kfifo; - ra->request_update = &iio_request_update_kfifo; - - ra->get_bytes_per_datum = &iio_get_bytes_per_datum_kfifo; - ra->set_bytes_per_datum = &iio_set_bytes_per_datum_kfifo; - ra->get_length = &iio_get_length_kfifo; - ra->set_length = &iio_set_length_kfifo; -}; +extern const struct iio_ring_access_funcs kfifo_access_funcs; struct iio_ring_buffer *iio_kfifo_allocate(struct iio_dev *indio_dev); void iio_kfifo_free(struct iio_ring_buffer *r); |