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, Michael.Hennerich@analog.com,
	manuel.stahl@iis.fraunhofer.de,
	Jonathan Cameron <jic23@kernel.org>
Subject: [PATCH 15/16] staging:iio:ring_sw don't provide read last function.
Date: Sun, 27 Nov 2011 13:33:44 +0000	[thread overview]
Message-ID: <1322400825-29400-16-git-send-email-jic23@kernel.org> (raw)
In-Reply-To: <1322400825-29400-1-git-send-email-jic23@kernel.org>

No longer needed as we don't have drivers providing sysfs access
to buffered data.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
---
 drivers/staging/iio/ring_sw.c |   33 ---------------------------------
 1 files changed, 0 insertions(+), 33 deletions(-)

diff --git a/drivers/staging/iio/ring_sw.c b/drivers/staging/iio/ring_sw.c
index 98fe819..37d26e6 100644
--- a/drivers/staging/iio/ring_sw.c
+++ b/drivers/staging/iio/ring_sw.c
@@ -23,7 +23,6 @@
  * @data:		the ring buffer memory
  * @read_p:		read pointer (oldest available)
  * @write_p:		write pointer
- * @last_written_p:	read pointer (newest available)
  * @half_p:		half buffer length behind write_p (event generation)
  * @use_count:		reference count to prevent resizing when in use
  * @update_needed:	flag to indicated change in size requested
@@ -37,7 +36,6 @@ struct iio_sw_ring_buffer {
 	unsigned char		*data;
 	unsigned char		*read_p;
 	unsigned char		*write_p;
-	unsigned char		*last_written_p;
 	/* used to act as a point at which to signal an event */
 	unsigned char		*half_p;
 	int			use_count;
@@ -56,7 +54,6 @@ static inline int __iio_allocate_sw_ring_buffer(struct iio_sw_ring_buffer *ring,
 	ring->data = kmalloc(length*ring->buf.bytes_per_datum, GFP_ATOMIC);
 	ring->read_p = NULL;
 	ring->write_p = NULL;
-	ring->last_written_p = NULL;
 	ring->half_p = NULL;
 	return ring->data ? 0 : -ENOMEM;
 }
@@ -115,7 +112,6 @@ static int iio_store_to_sw_ring(struct iio_sw_ring_buffer *ring,
 	 * Always valid as either points to latest or second latest value.
 	 * Before this runs it is null and read attempts fail with -EAGAIN.
 	 */
-	ring->last_written_p = ring->write_p;
 	barrier();
 	/* temp_ptr used to ensure we never have an invalid pointer
 	 * it may be slightly lagging, but never invalid
@@ -305,34 +301,6 @@ static int iio_store_to_sw_rb(struct iio_buffer *r,
 	return iio_store_to_sw_ring(ring, data, timestamp);
 }
 
-static int iio_read_last_from_sw_ring(struct iio_sw_ring_buffer *ring,
-				      unsigned char *data)
-{
-	unsigned char *last_written_p_copy;
-
-	iio_mark_sw_rb_in_use(&ring->buf);
-again:
-	barrier();
-	last_written_p_copy = ring->last_written_p;
-	barrier(); /*unnessecary? */
-	/* Check there is anything here */
-	if (last_written_p_copy == NULL)
-		return -EAGAIN;
-	memcpy(data, last_written_p_copy, ring->buf.bytes_per_datum);
-
-	if (unlikely(ring->last_written_p != last_written_p_copy))
-		goto again;
-
-	iio_unmark_sw_rb_in_use(&ring->buf);
-	return 0;
-}
-
-static int iio_read_last_from_sw_rb(struct iio_buffer *r,
-			     unsigned char *data)
-{
-	return iio_read_last_from_sw_ring(iio_to_sw_ring(r), data);
-}
-
 static int iio_request_update_sw_rb(struct iio_buffer *r)
 {
 	int ret = 0;
@@ -435,7 +403,6 @@ const struct iio_buffer_access_funcs ring_sw_access_funcs = {
 	.mark_in_use = &iio_mark_sw_rb_in_use,
 	.unmark_in_use = &iio_unmark_sw_rb_in_use,
 	.store_to = &iio_store_to_sw_rb,
-	.read_last = &iio_read_last_from_sw_rb,
 	.read_first_n = &iio_read_first_n_sw_rb,
 	.mark_param_change = &iio_mark_update_needed_sw_rb,
 	.request_update = &iio_request_update_sw_rb,
-- 
1.7.7.3

  parent reply	other threads:[~2011-11-27 13:33 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-27 13:33 [PATCH 00/16] staging:iio: buffer cleanup series Jonathan Cameron
2011-11-27 13:33 ` [PATCH 01/16] staging:iio:buffer drop bpe field Jonathan Cameron
2011-11-27 13:33 ` [PATCH 02/16] staging:iio: remove userspace access to bytes per datum Jonathan Cameron
2011-11-27 13:33 ` [PATCH 03/16] staging:iio:buffer move setup ops from buffer instance to iio_dev Jonathan Cameron
2011-11-27 13:33 ` [PATCH 04/16] staging:iio: scrap scan_count and ensure all drivers use active_scan_mask Jonathan Cameron
2011-11-28  9:45   ` Lars-Peter Clausen
2011-11-28 16:15     ` Lars-Peter Clausen
2011-11-28 21:02       ` Jonathan Cameron
2011-11-28 21:19         ` Lars-Peter Clausen
2011-11-28 21:31           ` Jonathan Cameron
2011-11-27 13:33 ` [PATCH 05/16] staging:iio:buffer remove unused owner field from struct iio_buffer Jonathan Cameron
2011-11-27 13:33 ` [PATCH 06/16] staging:iio:accel:lis3l02dq scrap reading from buffer for sysfs access Jonathan Cameron
2011-11-27 13:33 ` [PATCH 10/16] staging:iio:adc:ad7606 remove buffer access to data from sysfs read Jonathan Cameron
2011-11-27 13:33 ` [PATCH 11/16] staging:iio:adc:ad7993 stop reading from buffer for sysfs raw read Jonathan Cameron
2011-11-27 13:33 ` [PATCH 12/16] staging:iio:adc:ad7887 stop reading from buffer for sysfs access Jonathan Cameron
2011-11-27 13:33 ` [PATCH 13/16] staging:iio:adc:ad799x stop reading from buffer for sysfs accesses Jonathan Cameron
2011-11-27 13:33 ` [PATCH 14/16] staging:iio:adc:max1363 stop reading from buffer for sysfs access Jonathan Cameron
2011-11-27 13:33 ` Jonathan Cameron [this message]
2011-11-27 13:33 ` [PATCH 16/16] staging:iio:buffer stop allowing for read_last callback Jonathan Cameron
2011-12-04 21:44 ` [PATCH 00/16] staging:iio: buffer cleanup series Lars-Peter Clausen

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=1322400825-29400-16-git-send-email-jic23@kernel.org \
    --to=jic23@kernel.org \
    --cc=Michael.Hennerich@analog.com \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=manuel.stahl@iis.fraunhofer.de \
    /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).