linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Josselin Costanzi <josselin.costanzi@mobile-devices.fr>,
	linux-iio@vger.kernel.org
Cc: lars@metafoo.de, yannick.bedhomme@mobile-devices.fr
Subject: Re: [PATCH 1/2] iio: staging: sca3000: hide stufftoread logic
Date: Sun, 29 Jun 2014 14:43:56 +0100	[thread overview]
Message-ID: <53B0181C.7020504@kernel.org> (raw)
In-Reply-To: <1403886001-23354-2-git-send-email-josselin.costanzi@mobile-devices.fr>

On 27/06/14 17:20, Josselin Costanzi wrote:
> Change sca3000_ring implementation so that it exports a data_available
> function to iio.
>
> Signed-off-by: Josselin Costanzi <josselin.costanzi@mobile-devices.fr>
Looks to be safe and sensible. Technically changes the requirements on buffers
but as your change makes the only non compliant one meet the new requirement
we are fine.

A sensible change on it's own so applied to the togreg branch of iio.git.


Thanks,

Jonathan
> ---
>   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,
>   };
>
>


  reply	other threads:[~2014-06-29 13:41 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 ` [PATCH 1/2] iio: staging: sca3000: hide stufftoread logic Josselin Costanzi
2014-06-29 13:43   ` Jonathan Cameron [this message]
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=53B0181C.7020504@kernel.org \
    --to=jic23@kernel.org \
    --cc=josselin.costanzi@mobile-devices.fr \
    --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).