staging: iio: push the main buffer chrdev down to the top level.
[deliverable/linux.git] / drivers / staging / iio / ring_generic.h
index 3f26f7175b6a30d09608c66f18c93930225c3c8c..db8d0d1469b9405a0052edc0e76c6550b043b99e 100644 (file)
@@ -10,6 +10,7 @@
 #ifndef _IIO_RING_GENERIC_H_
 #define _IIO_RING_GENERIC_H_
 #include "iio.h"
+#include "chrdev.h"
 
 #ifdef CONFIG_IIO_RING_BUFFER
 
@@ -84,16 +85,15 @@ struct iio_ring_setup_ops {
  * @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;
@@ -103,13 +103,14 @@ struct iio_ring_buffer {
        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;
 };
 
 /**
@@ -198,24 +199,15 @@ static inline int iio_scan_mask_set(struct iio_ring_buffer *ring, int bit)
        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);
 
@@ -223,9 +215,9 @@ void iio_ring_access_release(struct device *dev);
 
 /**
  * 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
@@ -272,7 +264,7 @@ int iio_sw_ring_preenable(struct iio_dev *indio_dev);
 
 #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)
@@ -280,7 +272,7 @@ static inline int iio_ring_buffer_register_ex(struct iio_ring_buffer *ring,
        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 */
This page took 0.032874 seconds and 5 git commands to generate.