aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Cameron <jic23@kernel.org>2012-04-21 05:09:34 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-04-24 14:23:37 -0400
commitf1264809eb7fe4227dc9fc47723b9bd44afc5641 (patch)
tree022492fc06b6128a8e22557c20231a2d400ed892
parent6b3b58ed15cdc27b1ded4487d74c1b7ae04aa162 (diff)
staging:iio: scan_index_timestamp move to iio_dev from buffer
This is just a locally cached value that is device specific (rather than buffer specific.) Hence it wants to come out of the buffer before we add multiple buffer support. Signed-off-by: Jonathan Cameron <jic23@kernel.org> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/iio/buffer.h2
-rw-r--r--drivers/staging/iio/iio.h2
-rw-r--r--drivers/staging/iio/industrialio-buffer.c7
3 files changed, 5 insertions, 6 deletions
diff --git a/drivers/staging/iio/buffer.h b/drivers/staging/iio/buffer.h
index df2046dcb623..3d3ea9ed53de 100644
--- a/drivers/staging/iio/buffer.h
+++ b/drivers/staging/iio/buffer.h
@@ -56,7 +56,6 @@ struct iio_buffer_access_funcs {
56 * @scan_el_attrs: [DRIVER] control of scan elements if that scan mode 56 * @scan_el_attrs: [DRIVER] control of scan elements if that scan mode
57 * control method is used 57 * control method is used
58 * @scan_mask: [INTERN] bitmask used in masking scan mode elements 58 * @scan_mask: [INTERN] bitmask used in masking scan mode elements
59 * @scan_index_timestamp:[INTERN] cache of the index to the timestamp
60 * @scan_timestamp: [INTERN] does the scan mode include a timestamp 59 * @scan_timestamp: [INTERN] does the scan mode include a timestamp
61 * @access: [DRIVER] buffer access functions associated with the 60 * @access: [DRIVER] buffer access functions associated with the
62 * implementation. 61 * implementation.
@@ -74,7 +73,6 @@ struct iio_buffer {
74 struct attribute_group *scan_el_attrs; 73 struct attribute_group *scan_el_attrs;
75 long *scan_mask; 74 long *scan_mask;
76 bool scan_timestamp; 75 bool scan_timestamp;
77 unsigned scan_index_timestamp;
78 const struct iio_buffer_access_funcs *access; 76 const struct iio_buffer_access_funcs *access;
79 struct list_head scan_el_dev_attr_list; 77 struct list_head scan_el_dev_attr_list;
80 struct attribute_group scan_el_group; 78 struct attribute_group scan_el_group;
diff --git a/drivers/staging/iio/iio.h b/drivers/staging/iio/iio.h
index a56276338343..6832c98b3a8b 100644
--- a/drivers/staging/iio/iio.h
+++ b/drivers/staging/iio/iio.h
@@ -305,6 +305,7 @@ struct iio_buffer_setup_ops {
305 * @masklength: [INTERN] the length of the mask established from 305 * @masklength: [INTERN] the length of the mask established from
306 * channels 306 * channels
307 * @active_scan_mask: [INTERN] union of all scan masks requested by buffers 307 * @active_scan_mask: [INTERN] union of all scan masks requested by buffers
308 * @scan_index_timestamp:[INTERN] cache of the index to the timestamp
308 * @trig: [INTERN] current device trigger (buffer modes) 309 * @trig: [INTERN] current device trigger (buffer modes)
309 * @pollfunc: [DRIVER] function run on trigger being received 310 * @pollfunc: [DRIVER] function run on trigger being received
310 * @channels: [DRIVER] channel specification structure table 311 * @channels: [DRIVER] channel specification structure table
@@ -339,6 +340,7 @@ struct iio_dev {
339 const unsigned long *available_scan_masks; 340 const unsigned long *available_scan_masks;
340 unsigned masklength; 341 unsigned masklength;
341 const unsigned long *active_scan_mask; 342 const unsigned long *active_scan_mask;
343 unsigned scan_index_timestamp;
342 struct iio_trigger *trig; 344 struct iio_trigger *trig;
343 struct iio_poll_func *pollfunc; 345 struct iio_poll_func *pollfunc;
344 346
diff --git a/drivers/staging/iio/industrialio-buffer.c b/drivers/staging/iio/industrialio-buffer.c
index 389fe16872b4..03591619c74f 100644
--- a/drivers/staging/iio/industrialio-buffer.c
+++ b/drivers/staging/iio/industrialio-buffer.c
@@ -296,7 +296,7 @@ int iio_buffer_register(struct iio_dev *indio_dev,
296 goto error_cleanup_dynamic; 296 goto error_cleanup_dynamic;
297 attrcount += ret; 297 attrcount += ret;
298 if (channels[i].type == IIO_TIMESTAMP) 298 if (channels[i].type == IIO_TIMESTAMP)
299 buffer->scan_index_timestamp = 299 indio_dev->scan_index_timestamp =
300 channels[i].scan_index; 300 channels[i].scan_index;
301 } 301 }
302 if (indio_dev->masklength && buffer->scan_mask == NULL) { 302 if (indio_dev->masklength && buffer->scan_mask == NULL) {
@@ -525,8 +525,7 @@ static int iio_compute_scan_bytes(struct iio_dev *indio_dev, const long *mask,
525 } 525 }
526 if (timestamp) { 526 if (timestamp) {
527 ch = iio_find_channel_from_si(indio_dev, 527 ch = iio_find_channel_from_si(indio_dev,
528 indio_dev 528 indio_dev->scan_index_timestamp);
529 ->buffer->scan_index_timestamp);
530 length = ch->scan_type.storagebits / 8; 529 length = ch->scan_type.storagebits / 8;
531 bytes = ALIGN(bytes, length); 530 bytes = ALIGN(bytes, length);
532 bytes += length; 531 bytes += length;
@@ -721,7 +720,7 @@ int iio_update_demux(struct iio_dev *indio_dev)
721 goto error_clear_mux_table; 720 goto error_clear_mux_table;
722 } 721 }
723 ch = iio_find_channel_from_si(indio_dev, 722 ch = iio_find_channel_from_si(indio_dev,
724 buffer->scan_index_timestamp); 723 indio_dev->scan_index_timestamp);
725 length = ch->scan_type.storagebits/8; 724 length = ch->scan_type.storagebits/8;
726 if (out_loc % length) 725 if (out_loc % length)
727 out_loc += length - out_loc % length; 726 out_loc += length - out_loc % length;