#ifndef _IIO_RING_GENERIC_H_
#define _IIO_RING_GENERIC_H_
#include "iio.h"
+#include "chrdev.h"
#ifdef CONFIG_IIO_RING_BUFFER
* @scan_count: [INTERN] the number of elements in the current scan mode
* @scan_mask: [INTERN] bitmask used in masking scan mode elements
* @scan_timestamp: [INTERN] does the scan mode include a timestamp
- * @access_handler: [INTERN] chrdev access handling
* @access: [DRIVER] ring access functions associated with the
* implementation.
* @preenable: [DRIVER] function to run prior to marking ring enabled
* @postenable: [DRIVER] function to run after marking ring enabled
* @predisable: [DRIVER] function to run prior to marking ring disabled
* @postdisable: [DRIVER] function to run after marking ring disabled
+ * @flags: [INTERN] file ops related flags including busy flag.
**/
struct iio_ring_buffer {
- struct device dev;
struct iio_dev *indio_dev;
struct module *owner;
int length;
int scan_count;
unsigned long scan_mask;
bool scan_timestamp;
- struct iio_handler access_handler;
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;
bool stufftoread;
+ unsigned long flags;
+ const struct attribute_group *attrs;
};
/**
return 0;
};
-/**
- * iio_put_ring_buffer() - notify done with buffer
- * @ring: the buffer we are done with.
- **/
-static inline void iio_put_ring_buffer(struct iio_ring_buffer *ring)
-{
- put_device(&ring->dev);
-};
-
#define to_iio_ring_buffer(d) \
container_of(d, struct iio_ring_buffer, dev)
/**
* iio_ring_buffer_register_ex() - register the buffer with IIO core
- * @ring: the buffer to be registered
+ * @indio_dev: device with the buffer to be registered
* @id: the id of the buffer (typically 0)
**/
-int iio_ring_buffer_register_ex(struct iio_ring_buffer *ring, int id,
+int iio_ring_buffer_register_ex(struct iio_dev *indio_dev, int id,
const struct iio_chan_spec *channels,
int num_channels);
/**
* iio_ring_buffer_unregister() - unregister the buffer from IIO core
- * @ring: the buffer to be unregistered
+ * @indio_dev: the device with the buffer to be unregistered
**/
-void iio_ring_buffer_unregister(struct iio_ring_buffer *ring);
+void iio_ring_buffer_unregister(struct iio_dev *indio_dev);
/**
* iio_read_ring_length() - attr func to get number of datums in the buffer
#else /* CONFIG_IIO_RING_BUFFER */
-static inline int iio_ring_buffer_register_ex(struct iio_ring_buffer *ring,
+static inline int iio_ring_buffer_register_ex(struct iio_dev *indio_dev,
int id,
struct iio_chan_spec *channels,
int num_channels)
return 0;
}
-static inline void iio_ring_buffer_unregister(struct iio_ring_buffer *ring)
+static inline void iio_ring_buffer_unregister(struct iio_dev *indio_dev)
{};
#endif /* CONFIG_IIO_RING_BUFFER */