]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
staging:iio:buffer move setup ops from buffer instance to iio_dev
authorJonathan Cameron <jic23@cam.ac.uk>
Mon, 5 Dec 2011 22:18:14 +0000 (22:18 +0000)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 8 Dec 2011 20:11:08 +0000 (12:11 -0800)
These callbacks should not be buffer instance specific.
Hence move them out of the buffer.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
23 files changed:
drivers/staging/iio/accel/adis16201_ring.c
drivers/staging/iio/accel/adis16203_ring.c
drivers/staging/iio/accel/adis16204_ring.c
drivers/staging/iio/accel/adis16209_ring.c
drivers/staging/iio/accel/adis16240_ring.c
drivers/staging/iio/accel/lis3l02dq_ring.c
drivers/staging/iio/accel/sca3000_ring.c
drivers/staging/iio/adc/ad7192.c
drivers/staging/iio/adc/ad7298_ring.c
drivers/staging/iio/adc/ad7476_ring.c
drivers/staging/iio/adc/ad7606_ring.c
drivers/staging/iio/adc/ad7793.c
drivers/staging/iio/adc/ad7887_ring.c
drivers/staging/iio/adc/ad799x_ring.c
drivers/staging/iio/adc/max1363_ring.c
drivers/staging/iio/buffer.h
drivers/staging/iio/gyro/adis16260_ring.c
drivers/staging/iio/iio.h
drivers/staging/iio/iio_simple_dummy_buffer.c
drivers/staging/iio/impedance-analyzer/ad5933.c
drivers/staging/iio/imu/adis16400_ring.c
drivers/staging/iio/industrialio-buffer.c
drivers/staging/iio/meter/ade7758_ring.c

index 184c9dd8361ed2d1d70e94e0ae7252a0db4539cb..936e8cb7f3078fc688a8bb081ef1a17425f36118 100644 (file)
@@ -118,7 +118,7 @@ int adis16201_configure_ring(struct iio_dev *indio_dev)
        /* Effectively select the ring buffer implementation */
        ring->scan_timestamp = true;
        ring->access = &ring_sw_access_funcs;
-       ring->setup_ops = &adis16201_ring_setup_ops;
+       indio_dev->setup_ops = &adis16201_ring_setup_ops;
        ring->owner = THIS_MODULE;
 
        indio_dev->pollfunc = iio_alloc_pollfunc(&iio_pollfunc_store_time,
index da170c89768ffeb4d0589640c6dbc1f0843a5d4e..d41a50b6f9385a161ba74900acfaac9b778f1a4d 100644 (file)
@@ -120,7 +120,7 @@ int adis16203_configure_ring(struct iio_dev *indio_dev)
        /* Effectively select the ring buffer implementation */
        ring->scan_timestamp = true;
        ring->access = &ring_sw_access_funcs;
-       ring->setup_ops = &adis16203_ring_setup_ops;
+       indio_dev->setup_ops = &adis16203_ring_setup_ops;
        ring->owner = THIS_MODULE;
 
        indio_dev->pollfunc = iio_alloc_pollfunc(&iio_pollfunc_store_time,
index 109456407e4baaa8a0183aca497dfdbb67464143..d05d31136b57bb8dff8bbd616ffb8146e096bac0 100644 (file)
@@ -115,7 +115,7 @@ int adis16204_configure_ring(struct iio_dev *indio_dev)
        /* Effectively select the ring buffer implementation */
        ring->access = &ring_sw_access_funcs;
        ring->scan_timestamp = true;
-       ring->setup_ops = &adis16204_ring_setup_ops;
+       indio_dev->setup_ops = &adis16204_ring_setup_ops;
        ring->owner = THIS_MODULE;
 
        indio_dev->pollfunc = iio_alloc_pollfunc(&iio_pollfunc_store_time,
index e9158ed013e39617cb9eeb75e6f6e0c0ecb12ae2..da9946a06aa87dd7ac5321b1010b3e3fe4e4bcba 100644 (file)
@@ -115,7 +115,7 @@ int adis16209_configure_ring(struct iio_dev *indio_dev)
        /* Effectively select the ring buffer implementation */
        ring->access = &ring_sw_access_funcs;
        ring->scan_timestamp = true;
-       ring->setup_ops = &adis16209_ring_setup_ops;
+       indio_dev->setup_ops = &adis16209_ring_setup_ops;
        ring->owner = THIS_MODULE;
 
        indio_dev->pollfunc = iio_alloc_pollfunc(&iio_pollfunc_store_time,
index 5b02e5ae9052c46b9b15b1c44706d9979b84844f..aa215b9a864ab8de723af1429775f8f814110b7f 100644 (file)
@@ -112,7 +112,7 @@ int adis16240_configure_ring(struct iio_dev *indio_dev)
        /* Effectively select the ring buffer implementation */
        ring->access = &ring_sw_access_funcs;
        ring->scan_timestamp = true;
-       ring->setup_ops = &adis16240_ring_setup_ops;
+       indio_dev->setup_ops = &adis16240_ring_setup_ops;
        ring->owner = THIS_MODULE;
 
        indio_dev->pollfunc = iio_alloc_pollfunc(&iio_pollfunc_store_time,
index f5fe332924705df527bfe70212a2338303e56495..8c98cd11e17d8b7debad0fba3f17af7515402632 100644 (file)
@@ -438,7 +438,7 @@ int lis3l02dq_configure_buffer(struct iio_dev *indio_dev)
        indio_dev->buffer->access = &lis3l02dq_access_funcs;
 
        buffer->scan_timestamp = true;
-       buffer->setup_ops = &lis3l02dq_buffer_setup_ops;
+       indio_dev->setup_ops = &lis3l02dq_buffer_setup_ops;
        buffer->owner = THIS_MODULE;
 
        /* Functions are NULL as we set handler below */
index 4e1d938ca1b9880da463e5af26cfa465816ddba3..6a27a95bbba595a0d0b58f3f9d9577d3a7297162 100644 (file)
@@ -348,7 +348,7 @@ static const struct iio_buffer_setup_ops sca3000_ring_setup_ops = {
 
 void sca3000_register_ring_funcs(struct iio_dev *indio_dev)
 {
-       indio_dev->buffer->setup_ops = &sca3000_ring_setup_ops;
+       indio_dev->setup_ops = &sca3000_ring_setup_ops;
 }
 
 /**
index f48a0d48d15289e79099400bf81e8d245e4f8c20..ad6cef5ddb4d1540685a75494e466899183b7929 100644 (file)
@@ -592,7 +592,7 @@ static int ad7192_register_ring_funcs_and_init(struct iio_dev *indio_dev)
        }
 
        /* Ring buffer functions - here trigger setup related */
-       indio_dev->buffer->setup_ops = &ad7192_ring_setup_ops;
+       indio_dev->setup_ops = &ad7192_ring_setup_ops;
 
        /* Flag that polled ring buffering is possible */
        indio_dev->modes |= INDIO_BUFFER_TRIGGERED;
index 192328edeb29c453ccd22ac7a9ec4178cbacbf31..611e212746cf8e9355a6ce058d2e5ff64b279f25 100644 (file)
@@ -174,7 +174,7 @@ int ad7298_register_ring_funcs_and_init(struct iio_dev *indio_dev)
        }
 
        /* Ring buffer functions - here trigger setup related */
-       indio_dev->buffer->setup_ops = &ad7298_ring_setup_ops;
+       indio_dev->setup_ops = &ad7298_ring_setup_ops;
        indio_dev->buffer->scan_timestamp = true;
 
        /* Flag that polled ring buffering is possible */
index 09618873986e44aa0f458f91f54cac6277facf44..2dad7f8e1ace57a34ccb4f356f61e7f714babc54 100644 (file)
@@ -137,7 +137,7 @@ int ad7476_register_ring_funcs_and_init(struct iio_dev *indio_dev)
        }
 
        /* Ring buffer functions - here trigger setup related */
-       indio_dev->buffer->setup_ops = &ad7476_ring_setup_ops;
+       indio_dev->setup_ops = &ad7476_ring_setup_ops;
        indio_dev->buffer->scan_timestamp = true;
 
        /* Flag that polled ring buffering is possible */
index 203c914528e4d687e8f99dee77c73f66c588e960..f682af652a8f76710833f0968e26756f0d6e0ffe 100644 (file)
@@ -150,7 +150,7 @@ int ad7606_register_ring_funcs_and_init(struct iio_dev *indio_dev)
 
        /* Ring buffer functions - here trigger setup related */
 
-       indio_dev->buffer->setup_ops = &ad7606_ring_setup_ops;
+       indio_dev->setup_ops = &ad7606_ring_setup_ops;
        indio_dev->buffer->scan_timestamp = true ;
 
        INIT_WORK(&st->poll_work, &ad7606_poll_bh_to_ring);
index a70e53a2b8214a31bce40afd6c4dead9b83f855a..c12207abc348a39b15a899d2ccdcf77ef495693a 100644 (file)
@@ -459,7 +459,7 @@ static int ad7793_register_ring_funcs_and_init(struct iio_dev *indio_dev)
        }
 
        /* Ring buffer functions - here trigger setup related */
-       indio_dev->buffer->setup_ops = &ad7793_ring_setup_ops;
+       indio_dev->setup_ops = &ad7793_ring_setup_ops;
 
        /* Flag that polled ring buffering is possible */
        indio_dev->modes |= INDIO_BUFFER_TRIGGERED;
index fbe21b5bd3dd38766320fb4b64e29d29eedf3841..fee338c0a38231f287a49e40d75ae801445987e0 100644 (file)
@@ -176,7 +176,7 @@ int ad7887_register_ring_funcs_and_init(struct iio_dev *indio_dev)
                goto error_deallocate_sw_rb;
        }
        /* Ring buffer functions - here trigger setup related */
-       indio_dev->buffer->setup_ops = &ad7887_ring_setup_ops;
+       indio_dev->setup_ops = &ad7887_ring_setup_ops;
 
        /* Flag that polled ring buffering is possible */
        indio_dev->modes |= INDIO_BUFFER_TRIGGERED;
index b215a1f5a02b813c087db93be5555b69c9182fcb..50c1216558f830587a42baa4b7c5a16cbb33fe80 100644 (file)
@@ -183,7 +183,7 @@ int ad799x_register_ring_funcs_and_init(struct iio_dev *indio_dev)
        }
 
        /* Ring buffer functions - here trigger setup related */
-       indio_dev->buffer->setup_ops = &ad799x_buf_setup_ops;
+       indio_dev->setup_ops = &ad799x_buf_setup_ops;
        indio_dev->buffer->scan_timestamp = true;
 
        /* Flag that polled ring buffering is possible */
index 19977a6d94c1bea0a98519d59310784511a4117d..3a38a267b581ef22cde24e9cf8183350943f4d8f 100644 (file)
@@ -155,7 +155,7 @@ int max1363_register_ring_funcs_and_init(struct iio_dev *indio_dev)
        /* Effectively select the ring buffer implementation */
        indio_dev->buffer->access = &ring_sw_access_funcs;
        /* Ring buffer functions - here trigger setup related */
-       indio_dev->buffer->setup_ops = &max1363_ring_setup_ops;
+       indio_dev->setup_ops = &max1363_ring_setup_ops;
 
        /* Flag that polled ring buffering is possible */
        indio_dev->modes |= INDIO_BUFFER_TRIGGERED;
index 91717355046e4cac165eef8531eccf814afa3400..58c75715756c73051cd547d56ecb508b8f360666 100644 (file)
@@ -65,21 +65,6 @@ struct iio_buffer_access_funcs {
        int (*enable)(struct iio_buffer *buffer);
 };
 
-/**
- * struct iio_buffer_setup_ops - buffer setup related callbacks
- * @preenable:         [DRIVER] function to run prior to marking buffer enabled
- * @postenable:                [DRIVER] function to run after marking buffer enabled
- * @predisable:                [DRIVER] function to run prior to marking buffer
- *                     disabled
- * @postdisable:       [DRIVER] function to run after marking buffer disabled
- */
-struct iio_buffer_setup_ops {
-       int                             (*preenable)(struct iio_dev *);
-       int                             (*postenable)(struct iio_dev *);
-       int                             (*predisable)(struct iio_dev *);
-       int                             (*postdisable)(struct iio_dev *);
-};
-
 /**
  * struct iio_buffer - general buffer structure
  * @indio_dev:         industrial I/O device structure
@@ -108,7 +93,6 @@ struct iio_buffer {
        bool                                    scan_timestamp;
        unsigned                                scan_index_timestamp;
        const struct iio_buffer_access_funcs    *access;
-       const struct iio_buffer_setup_ops               *setup_ops;
        struct list_head                        scan_el_dev_attr_list;
        struct attribute_group                  scan_el_group;
        wait_queue_head_t                       pollq;
index c8d22f525fa6cf565b9495112e124d8d6ab5b8aa..446d78f2a3f43d23c845c2fbc4241b409bac4117 100644 (file)
@@ -117,7 +117,7 @@ int adis16260_configure_ring(struct iio_dev *indio_dev)
        /* Effectively select the ring buffer implementation */
        ring->access = &ring_sw_access_funcs;
        ring->scan_timestamp = true;
-       ring->setup_ops = &adis16260_ring_setup_ops;
+       indio_dev->setup_ops = &adis16260_ring_setup_ops;
        ring->owner = THIS_MODULE;
 
        indio_dev->pollfunc = iio_alloc_pollfunc(&iio_pollfunc_store_time,
index 11c2f25cfaa70c789f4a69bf2f637d035803d6bd..45b6d759c2e7f68098fe8966ef03bfbdab9798f2 100644 (file)
@@ -271,6 +271,21 @@ struct iio_info {
                                const unsigned long *scan_mask);
 };
 
+/**
+ * struct iio_buffer_setup_ops - buffer setup related callbacks
+ * @preenable:         [DRIVER] function to run prior to marking buffer enabled
+ * @postenable:                [DRIVER] function to run after marking buffer enabled
+ * @predisable:                [DRIVER] function to run prior to marking buffer
+ *                     disabled
+ * @postdisable:       [DRIVER] function to run after marking buffer disabled
+ */
+struct iio_buffer_setup_ops {
+       int                             (*preenable)(struct iio_dev *);
+       int                             (*postenable)(struct iio_dev *);
+       int                             (*predisable)(struct iio_dev *);
+       int                             (*postdisable)(struct iio_dev *);
+};
+
 /**
  * struct iio_dev - industrial I/O device
  * @id:                        [INTERN] used to identify device internally
@@ -324,6 +339,7 @@ struct iio_dev {
        struct attribute_group          chan_attr_group;
        const char                      *name;
        const struct iio_info           *info;
+       const struct iio_buffer_setup_ops       *setup_ops;
        struct cdev                     chrdev;
 #define IIO_MAX_GROUPS 6
        const struct attribute_group    *groups[IIO_MAX_GROUPS + 1];
index 1f1c273054cbfdaee239ed8d546d9f679266f270..ce098bef623210ad50fedc4f4389c4dcdd8a49a0 100644 (file)
@@ -149,7 +149,7 @@ int iio_simple_dummy_configure_buffer(struct iio_dev *indio_dev)
         * Tell the core what device type specific functions should
         * be run on either side of buffer capture enable / disable.
         */
-       buffer->setup_ops = &iio_simple_dummy_buffer_setup_ops;
+       indio_dev->setup_ops = &iio_simple_dummy_buffer_setup_ops;
        buffer->owner = THIS_MODULE;
 
        /*
index 966f768819f12a9031b7b9c08ade06a66faf5b97..b059b781183f8855c1e809085117585bf8fbad96 100644 (file)
@@ -611,7 +611,7 @@ static int ad5933_register_ring_funcs_and_init(struct iio_dev *indio_dev)
        indio_dev->buffer->access = &ring_sw_access_funcs;
 
        /* Ring buffer functions - here trigger setup related */
-       indio_dev->buffer->setup_ops = &ad5933_ring_setup_ops;
+       indio_dev->setup_ops = &ad5933_ring_setup_ops;
 
        indio_dev->modes |= INDIO_BUFFER_HARDWARE;
 
index cee61aa49b499bf006b48d5f71b098352ae3527d..e8aaa84c613fd98d26dc034ed13643eb1ff7e008 100644 (file)
@@ -187,7 +187,7 @@ int adis16400_configure_ring(struct iio_dev *indio_dev)
        /* Effectively select the ring buffer implementation */
        ring->access = &ring_sw_access_funcs;
        ring->scan_timestamp = true;
-       ring->setup_ops = &adis16400_ring_setup_ops;
+       indio_dev->setup_ops = &adis16400_ring_setup_ops;
        ring->owner = THIS_MODULE;
 
        indio_dev->pollfunc = iio_alloc_pollfunc(&iio_pollfunc_store_time,
index fb6ad39b264a1b8a9c6a4c97e0b69ede8d57ce2a..4f5a641832f4a005d127a11e663497671af4c8fe 100644 (file)
@@ -428,8 +428,8 @@ ssize_t iio_buffer_store_enable(struct device *dev,
                goto done;
        }
        if (requested_state) {
-               if (buffer->setup_ops->preenable) {
-                       ret = buffer->setup_ops->preenable(indio_dev);
+               if (indio_dev->setup_ops->preenable) {
+                       ret = indio_dev->setup_ops->preenable(indio_dev);
                        if (ret) {
                                printk(KERN_ERR
                                       "Buffer not started:"
@@ -466,8 +466,8 @@ ssize_t iio_buffer_store_enable(struct device *dev,
                        goto error_ret;
                }
 
-               if (buffer->setup_ops->postenable) {
-                       ret = buffer->setup_ops->postenable(indio_dev);
+               if (indio_dev->setup_ops->postenable) {
+                       ret = indio_dev->setup_ops->postenable(indio_dev);
                        if (ret) {
                                printk(KERN_INFO
                                       "Buffer not started:"
@@ -475,23 +475,23 @@ ssize_t iio_buffer_store_enable(struct device *dev,
                                if (buffer->access->unmark_in_use)
                                        buffer->access->unmark_in_use(buffer);
                                indio_dev->currentmode = previous_mode;
-                               if (buffer->setup_ops->postdisable)
-                                       buffer->setup_ops->
+                               if (indio_dev->setup_ops->postdisable)
+                                       indio_dev->setup_ops->
                                                postdisable(indio_dev);
                                goto error_ret;
                        }
                }
        } else {
-               if (buffer->setup_ops->predisable) {
-                       ret = buffer->setup_ops->predisable(indio_dev);
+               if (indio_dev->setup_ops->predisable) {
+                       ret = indio_dev->setup_ops->predisable(indio_dev);
                        if (ret)
                                goto error_ret;
                }
                if (buffer->access->unmark_in_use)
                        buffer->access->unmark_in_use(buffer);
                indio_dev->currentmode = INDIO_DIRECT_MODE;
-               if (buffer->setup_ops->postdisable) {
-                       ret = buffer->setup_ops->postdisable(indio_dev);
+               if (indio_dev->setup_ops->postdisable) {
+                       ret = indio_dev->setup_ops->postdisable(indio_dev);
                        if (ret)
                                goto error_ret;
                }
index 00fa2ac5c4597636ef4ffa7050bc1b64464e5c9e..464713a34ae0fb71465e88130b2763319498bf5b 100644 (file)
@@ -145,7 +145,7 @@ int ade7758_configure_ring(struct iio_dev *indio_dev)
 
        /* Effectively select the ring buffer implementation */
        indio_dev->buffer->access = &ring_sw_access_funcs;
-       indio_dev->buffer->setup_ops = &ade7758_ring_setup_ops;
+       indio_dev->setup_ops = &ade7758_ring_setup_ops;
        indio_dev->buffer->owner = THIS_MODULE;
 
        indio_dev->pollfunc = iio_alloc_pollfunc(&iio_pollfunc_store_time,