From: Josselin Costanzi <josselin.costanzi@mobile-devices.fr>
To: linux-iio@vger.kernel.org
Cc: jic23@kernel.org, lars@metafoo.de,
yannick.bedhomme@mobile-devices.fr,
Josselin Costanzi <josselin.costanzi@mobile-devices.fr>
Subject: [PATCH 1/2] iio: staging: sca3000: hide stufftoread logic
Date: Fri, 27 Jun 2014 18:20:00 +0200 [thread overview]
Message-ID: <1403886001-23354-2-git-send-email-josselin.costanzi@mobile-devices.fr> (raw)
In-Reply-To: <1403886001-23354-1-git-send-email-josselin.costanzi@mobile-devices.fr>
Change sca3000_ring implementation so that it exports a data_available
function to iio.
Signed-off-by: Josselin Costanzi <josselin.costanzi@mobile-devices.fr>
---
drivers/iio/industrialio-buffer.c | 5 +----
drivers/staging/iio/accel/sca3000_ring.c | 6 ++++++
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c
index 36b1ae9..2952ee0 100644
--- a/drivers/iio/industrialio-buffer.c
+++ b/drivers/iio/industrialio-buffer.c
@@ -39,10 +39,7 @@ static bool iio_buffer_is_active(struct iio_buffer *buf)
static bool iio_buffer_data_available(struct iio_buffer *buf)
{
- if (buf->access->data_available)
- return buf->access->data_available(buf);
-
- return buf->stufftoread;
+ return buf->access->data_available(buf);
}
/**
diff --git a/drivers/staging/iio/accel/sca3000_ring.c b/drivers/staging/iio/accel/sca3000_ring.c
index 1987106..33f0e92 100644
--- a/drivers/staging/iio/accel/sca3000_ring.c
+++ b/drivers/staging/iio/accel/sca3000_ring.c
@@ -141,6 +141,11 @@ static int sca3000_ring_get_bytes_per_datum(struct iio_buffer *r)
return 6;
}
+static bool sca3000_ring_buf_data_available(struct iio_buffer *r)
+{
+ return r->stufftoread;
+}
+
static IIO_BUFFER_ENABLE_ATTR;
static IIO_BUFFER_LENGTH_ATTR;
@@ -274,6 +279,7 @@ static const struct iio_buffer_access_funcs sca3000_ring_access_funcs = {
.read_first_n = &sca3000_read_first_n_hw_rb,
.get_length = &sca3000_ring_get_length,
.get_bytes_per_datum = &sca3000_ring_get_bytes_per_datum,
+ .data_available = sca3000_ring_buf_data_available,
.release = sca3000_ring_release,
};
--
1.9.1
next prev parent reply other threads:[~2014-06-27 16:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-27 16:19 [PATCH v3 0/2] iio: add watermark logic to iio read and poll Josselin Costanzi
2014-06-27 16:20 ` Josselin Costanzi [this message]
2014-06-29 13:43 ` [PATCH 1/2] iio: staging: sca3000: hide stufftoread logic Jonathan Cameron
2014-06-27 16:20 ` [PATCH 2/2] iio: add watermark logic to iio read and poll Josselin Costanzi
2014-06-29 14:23 ` Jonathan Cameron
2014-07-01 14:36 ` Srinivas Pandruvada
2014-06-30 9:30 ` 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=1403886001-23354-2-git-send-email-josselin.costanzi@mobile-devices.fr \
--to=josselin.costanzi@mobile-devices.fr \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=yannick.bedhomme@mobile-devices.fr \
/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).