linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: linux-iio@vger.kernel.org
Cc: lars@metafoo.de, Jonathan Cameron <jic23@kernel.org>
Subject: [PATCH 03/14] staging:iio: scan_index_timestamp move to iio_dev from buffer
Date: Wed, 18 Apr 2012 14:13:43 +0100	[thread overview]
Message-ID: <1334754834-13622-4-git-send-email-jic23@kernel.org> (raw)
In-Reply-To: <1334754834-13622-1-git-send-email-jic23@kernel.org>

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>
---
 drivers/staging/iio/buffer.h              |    2 --
 drivers/staging/iio/iio.h                 |    2 ++
 drivers/staging/iio/industrialio-buffer.c |    7 +++----
 3 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/iio/buffer.h b/drivers/staging/iio/buffer.h
index df2046d..3d3ea9e 100644
--- a/drivers/staging/iio/buffer.h
+++ b/drivers/staging/iio/buffer.h
@@ -56,7 +56,6 @@ struct iio_buffer_access_funcs {
  * @scan_el_attrs:	[DRIVER] control of scan elements if that scan mode
  *			control method is used
  * @scan_mask:		[INTERN] bitmask used in masking scan mode elements
- * @scan_index_timestamp:[INTERN] cache of the index to the timestamp
  * @scan_timestamp:	[INTERN] does the scan mode include a timestamp
  * @access:		[DRIVER] buffer access functions associated with the
  *			implementation.
@@ -74,7 +73,6 @@ struct iio_buffer {
 	struct attribute_group			*scan_el_attrs;
 	long					*scan_mask;
 	bool					scan_timestamp;
-	unsigned				scan_index_timestamp;
 	const struct iio_buffer_access_funcs	*access;
 	struct list_head			scan_el_dev_attr_list;
 	struct attribute_group			scan_el_group;
diff --git a/drivers/staging/iio/iio.h b/drivers/staging/iio/iio.h
index a562763..6832c98 100644
--- a/drivers/staging/iio/iio.h
+++ b/drivers/staging/iio/iio.h
@@ -305,6 +305,7 @@ struct iio_buffer_setup_ops {
  * @masklength:		[INTERN] the length of the mask established from
  *			channels
  * @active_scan_mask:	[INTERN] union of all scan masks requested by buffers
+ * @scan_index_timestamp:[INTERN] cache of the index to the timestamp
  * @trig:		[INTERN] current device trigger (buffer modes)
  * @pollfunc:		[DRIVER] function run on trigger being received
  * @channels:		[DRIVER] channel specification structure table
@@ -339,6 +340,7 @@ struct iio_dev {
 	const unsigned long		*available_scan_masks;
 	unsigned			masklength;
 	const unsigned long		*active_scan_mask;
+	unsigned			scan_index_timestamp;
 	struct iio_trigger		*trig;
 	struct iio_poll_func		*pollfunc;
 
diff --git a/drivers/staging/iio/industrialio-buffer.c b/drivers/staging/iio/industrialio-buffer.c
index 639b41a..efa44c4 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,
 				goto error_cleanup_dynamic;
 			attrcount += ret;
 			if (channels[i].type == IIO_TIMESTAMP)
-				buffer->scan_index_timestamp =
+				indio_dev->scan_index_timestamp =
 					channels[i].scan_index;
 		}
 		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,
 	}
 	if (timestamp) {
 		ch = iio_find_channel_from_si(indio_dev,
-					      indio_dev
-					      ->buffer->scan_index_timestamp);
+					      indio_dev->scan_index_timestamp);
 		length = ch->scan_type.storagebits / 8;
 		bytes = ALIGN(bytes, length);
 		bytes += length;
@@ -721,7 +720,7 @@ int iio_update_demux(struct iio_dev *indio_dev)
 			goto error_clear_mux_table;
 		}
 		ch = iio_find_channel_from_si(indio_dev,
-			buffer->scan_index_timestamp);
+			indio_dev->scan_index_timestamp);
 		length = ch->scan_type.storagebits/8;
 		if (out_loc % length)
 			out_loc += length - out_loc % length;
-- 
1.7.0.4


  parent reply	other threads:[~2012-04-18 13:14 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-18 13:13 [PATCH 00/14] Staging:iio: Cleanup and refactor pre multibuffer Jonathan Cameron
2012-04-18 13:13 ` [PATCH 01/14] staging:iio:buffer trivial use of strtobool to remove dodgy equivalent Jonathan Cameron
2012-04-18 13:13 ` [PATCH 02/14] staging:iio:buffer: pull computation of scan length into a utility function Jonathan Cameron
2012-04-18 13:13 ` Jonathan Cameron [this message]
2012-04-18 13:13 ` [PATCH 04/14] staging:iio: add caching of the number of bytes in a scan Jonathan Cameron
     [not found]   ` <4F91944F.3070701@metafoo.de>
2012-04-20 17:02     ` Jonathan Cameron
2012-04-18 13:13 ` [PATCH 05/14] staging:iio:adc:ad7192 make use of iio_sw_buffer_preenable Jonathan Cameron
2012-04-18 13:13 ` [PATCH 06/14] staging:iio:adc:ad7298 use iio_sw_buffer_preenable to avoid code repitition Jonathan Cameron
2012-04-18 13:13 ` [PATCH 07/14] staging:iio:adc:ad7476 use iio_sw_buffer_preenable instead of local version Jonathan Cameron
2012-04-18 13:13 ` [PATCH 08/14] staging:iio:adc:ad7793 use iio_sw_buffer_preenable to avoid repitition Jonathan Cameron
2012-04-18 13:13 ` [PATCH 09/14] staging:iio:adc:ad7887 make use of iio_sw_buffer_preenable Jonathan Cameron
2012-04-18 13:13 ` [PATCH 10/14] staging:iio:adc:ad799x use iio_sw_buffer_preenable to avoid code repitiion Jonathan Cameron
2012-04-18 13:13 ` [PATCH 11/14] staging:iio:meter:ad7758 use iio_sw_buffer_preenable to avoid code repition Jonathan Cameron
2012-04-18 13:13 ` [PATCH 12/14] staging:iio:impedance-analyser make use of iio_sw_buffer_preenable Jonathan Cameron
2012-04-18 13:13 ` [PATCH 13/14] staging:iio: Add caching of scan_timestamp to the core as well as buffers Jonathan Cameron
2012-04-18 13:13 ` [PATCH 14/14] staging:iio: pull out demux cleanup for a particular buffer Jonathan Cameron
     [not found] ` <4F919648.2070503@metafoo.de>
2012-04-21  9:10   ` [PATCH 00/14] Staging:iio: Cleanup and refactor pre multibuffer Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1334754834-13622-4-git-send-email-jic23@kernel.org \
    --to=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).