linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Nuno Sá" <noname.nuno@gmail.com>
To: Mihail Chindris <mihail.chindris@analog.com>,
	linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org
Cc: lars@metafoo.de, Michael.Hennerich@analog.com, jic23@kernel.org,
	nuno.sa@analog.com, dragos.bogdan@analog.com,
	alexandru.ardelean@analog.com
Subject: Re: [PATCH v4 2/6] iio: kfifo-buffer: Add output buffer support
Date: Mon, 23 Aug 2021 15:51:39 +0200	[thread overview]
Message-ID: <0d872fd789603a2d4dd74594f841d4bea7de38d3.camel@gmail.com> (raw)
In-Reply-To: <20210820165927.4524-3-mihail.chindris@analog.com>

On Fri, 2021-08-20 at 16:59 +0000, Mihail Chindris wrote:
> From: Lars-Peter Clausen <lars@metafoo.de>
> 
> Add output buffer support to the kfifo buffer implementation.
> 
> The implementation is straight forward and mostly just wraps the
> kfifo
> API to provide the required operations.
> 
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
> Signed-off-by: Mihail Chindris <mihail.chindris@analog.com>
> ---
>  drivers/iio/buffer/kfifo_buf.c | 50
> ++++++++++++++++++++++++++++++++++
>  1 file changed, 50 insertions(+)
> 
> diff --git a/drivers/iio/buffer/kfifo_buf.c
> b/drivers/iio/buffer/kfifo_buf.c
> index 516eb3465de1..7368db2d5c32 100644
> --- a/drivers/iio/buffer/kfifo_buf.c
> +++ b/drivers/iio/buffer/kfifo_buf.c
> @@ -138,10 +138,60 @@ static void iio_kfifo_buffer_release(struct
> iio_buffer *buffer)
>  	kfree(kf);
>  }
>  
> +static size_t iio_kfifo_buf_space_available(struct iio_buffer *r)
> +{
> +	struct iio_kfifo *kf = iio_to_kfifo(r);
> +	size_t avail;
> +
> +	mutex_lock(&kf->user_lock);
> +	avail = kfifo_avail(&kf->kf);
> +	mutex_unlock(&kf->user_lock);
> +
> +	return avail;
> +}
> +
> +static int iio_kfifo_remove_from(struct iio_buffer *r, void *data)
> +{
> +	int ret;
> +	struct iio_kfifo *kf = iio_to_kfifo(r);
> +
> +	if (kfifo_size(&kf->kf) < 1)
> +		return -EBUSY;
> +
> +	ret = kfifo_out(&kf->kf, data, 1);
> +	if (ret != 1)
> +		return -EBUSY;
> +
> +	wake_up_interruptible_poll(&r->pollq, POLLOUT | POLLWRNORM);
> +
> +	return 0;
> +}
> +
> +static int iio_kfifo_write(struct iio_buffer *r, size_t n,
> +	const char __user *buf)
> +{

nit: I would align this with the open parenthesis...

- Nuno Sá



  parent reply	other threads:[~2021-08-23 13:51 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-20 16:59 [PATCH v4 0/6] iio: Add output buffer support and DAC example Mihail Chindris
2021-08-20 16:59 ` [PATCH v4 1/6] iio: Add output buffer support Mihail Chindris
2021-08-21  0:24   ` kernel test robot
2021-08-23  2:23   ` kernel test robot
2021-08-23 13:50   ` Nuno Sá
2021-08-30 15:42     ` Jonathan Cameron
2021-09-01  8:50       ` Sa, Nuno
2021-09-05  9:54         ` Jonathan Cameron
2021-08-25  8:35   ` Alexandru Ardelean
2021-08-30 16:05   ` Jonathan Cameron
2021-09-01  8:54     ` Sa, Nuno
2021-09-05  9:55       ` Jonathan Cameron
2021-09-16 10:57     ` Chindris, Mihail
2021-08-20 16:59 ` [PATCH v4 2/6] iio: kfifo-buffer: " Mihail Chindris
2021-08-21 14:15   ` kernel test robot
2021-08-23 13:51   ` Nuno Sá [this message]
2021-08-20 16:59 ` [PATCH v4 3/6] iio: triggered-buffer: extend support to configure output buffers Mihail Chindris
2021-08-21  3:28   ` kernel test robot
2021-08-20 16:59 ` [PATCH v4 4/6] Documentation:ABI:testing:add doc for AD3552R ABI Mihail Chindris
2021-08-30 15:22   ` Jonathan Cameron
2021-08-20 16:59 ` [PATCH v4 5/6] dt-bindings: iio: dac: Add adi,ad3552r.yaml Mihail Chindris
2021-08-30 15:37   ` Jonathan Cameron
2021-08-20 16:59 ` [PATCH v4 6/6] drivers:iio:dac: Add AD3552R driver support Mihail Chindris
2021-08-20 19:55   ` kernel test robot
2021-08-20 22:15   ` kernel test robot
2021-08-23 14:01   ` Nuno Sá
2021-08-30 16:54   ` Jonathan Cameron
2021-08-25  7:35 ` [PATCH v4 0/6] iio: Add output buffer support and DAC example Alexandru Ardelean
2021-08-30 15:17   ` 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=0d872fd789603a2d4dd74594f841d4bea7de38d3.camel@gmail.com \
    --to=noname.nuno@gmail.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=alexandru.ardelean@analog.com \
    --cc=dragos.bogdan@analog.com \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mihail.chindris@analog.com \
    --cc=nuno.sa@analog.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 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).