All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: srinivas pandruvada <srinivas.pandruvada@intel.com>
Cc: linux-iio@vger.kernel.org
Subject: Re: [PATCH] KFiFO : Poll support
Date: Mon, 27 Aug 2012 18:53:29 +0100	[thread overview]
Message-ID: <503BB419.4020106@kernel.org> (raw)
In-Reply-To: <1346089129-839-1-git-send-email-srinivas.pandruvada@intel.com>

On 08/27/2012 06:38 PM, srinivas pandruvada wrote:
> From: Jonathan Cameron <jic23@kernel.org>
> 
> Implements poll system call support on IIO Kfifo buffers.
> 
> Acked-by: srinivas pandruvada <srinivas.pandruvada@intel.com>
*laughs*
Delights of crossing emails.  Thanks this got to me before I pushed so
have added it :)
> ---
>  drivers/iio/kfifo_buf.c |    9 +++++++++
>  1 files changed, 9 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/iio/kfifo_buf.c b/drivers/iio/kfifo_buf.c
> index 6bf9d05..e8033a4 100644
> --- a/drivers/iio/kfifo_buf.c
> +++ b/drivers/iio/kfifo_buf.c
> @@ -6,6 +6,7 @@
>  #include <linux/kfifo.h>
>  #include <linux/mutex.h>
>  #include <linux/iio/kfifo_buf.h>
> +#include <linux/sched.h>
>  
>  struct iio_kfifo {
>  	struct iio_buffer buffer;
> @@ -35,6 +36,7 @@ static int iio_request_update_kfifo(struct iio_buffer *r)
>  	kfifo_free(&buf->kf);
>  	ret = __iio_allocate_kfifo(buf, buf->buffer.bytes_per_datum,
>  				   buf->buffer.length);
> +	r->stufftoread = false;
>  error_ret:
>  	return ret;
>  }
> @@ -97,6 +99,8 @@ static int iio_store_to_kfifo(struct iio_buffer *r,
>  	ret = kfifo_in(&kf->kf, data, r->bytes_per_datum);
>  	if (ret != r->bytes_per_datum)
>  		return -EBUSY;
> +	r->stufftoread = true;
> +	wake_up_interruptible(&r->pollq);
>  	return 0;
>  }
>  
> @@ -111,6 +115,11 @@ static int iio_read_first_n_kfifo(struct iio_buffer *r,
>  
>  	n = rounddown(n, r->bytes_per_datum);
>  	ret = kfifo_to_user(&kf->kf, buf, n, &copied);
> +	if (kfifo_is_empty(&kf->kf))
> +		r->stufftoread = false;
> +	/* verify it is still empty to avoid race */
> +	if (!kfifo_is_empty(&kf->kf))
> +		r->stufftoread = true;
>  
>  	return copied;
>  }
> 

           reply	other threads:[~2012-08-27 17:53 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <1346089129-839-1-git-send-email-srinivas.pandruvada@intel.com>]

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=503BB419.4020106@kernel.org \
    --to=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=srinivas.pandruvada@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.