Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1198724 > unrolled thread

[PATCH] iio: industrialio-buffer: Fix iio_buffer_poll return value

Started byCristina Opriceana <cristina.opriceana@gmail.com>
First post2015-08-03 12:40 +0200
Last post2015-08-03 12:50 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] iio: industrialio-buffer: Fix iio_buffer_poll return value Cristina Opriceana <cristina.opriceana@gmail.com> - 2015-08-03 12:40 +0200
    Re: [PATCH] iio: industrialio-buffer: Fix iio_buffer_poll return value Daniel Baluta <daniel.baluta@intel.com> - 2015-08-03 12:50 +0200

#1198724 — [PATCH] iio: industrialio-buffer: Fix iio_buffer_poll return value

FromCristina Opriceana <cristina.opriceana@gmail.com>
Date2015-08-03 12:40 +0200
Subject[PATCH] iio: industrialio-buffer: Fix iio_buffer_poll return value
Message-ID<pTljY-r2-19@gated-at.bofh.it>
Change return value to 0 if no device is bound since
unsigned int cannot support negative error codes.

Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
---
 drivers/iio/industrialio-buffer.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c
index faed6ef..e8e87cf 100644
--- a/drivers/iio/industrialio-buffer.c
+++ b/drivers/iio/industrialio-buffer.c
@@ -155,7 +155,9 @@ ssize_t iio_buffer_read_first_n_outer(struct file *filp, char __user *buf,
  *		a wait queue
  *
  * Return: (POLLIN | POLLRDNORM) if data is available for reading
- *	   or 0 for other cases
+ *	   and 0 for other cases, e.g. no device is bound or no
+ *	   hardware fifo flush could be triggered.
+ *
  */
 unsigned int iio_buffer_poll(struct file *filp,
 			     struct poll_table_struct *wait)
@@ -164,7 +166,7 @@ unsigned int iio_buffer_poll(struct file *filp,
 	struct iio_buffer *rb = indio_dev->buffer;
 
 	if (!indio_dev->info)
-		return -ENODEV;
+		return 0;
 
 	poll_wait(filp, &rb->pollq, wait);
 	if (iio_buffer_ready(indio_dev, rb, rb->watermark, 0))
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1198735

FromDaniel Baluta <daniel.baluta@intel.com>
Date2015-08-03 12:50 +0200
Message-ID<pTltE-CA-25@gated-at.bofh.it>
In reply to#1198724
On Mon, Aug 3, 2015 at 1:37 PM, Cristina Opriceana
<cristina.opriceana@gmail.com> wrote:
> Change return value to 0 if no device is bound since
> unsigned int cannot support negative error codes.
>
> Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>

Fixes: f18e7a068 ("iio: Return -ENODEV for file operations if the
device has been unregistered")

> ---
>  drivers/iio/industrialio-buffer.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c
> index faed6ef..e8e87cf 100644
> --- a/drivers/iio/industrialio-buffer.c
> +++ b/drivers/iio/industrialio-buffer.c
> @@ -155,7 +155,9 @@ ssize_t iio_buffer_read_first_n_outer(struct file *filp, char __user *buf,
>   *             a wait queue
>   *
>   * Return: (POLLIN | POLLRDNORM) if data is available for reading
> - *        or 0 for other cases
> + *        and 0 for other cases, e.g. no device is bound or no
> + *        hardware fifo flush could be triggered.
> + *
>   */
>  unsigned int iio_buffer_poll(struct file *filp,
>                              struct poll_table_struct *wait)
> @@ -164,7 +166,7 @@ unsigned int iio_buffer_poll(struct file *filp,
>         struct iio_buffer *rb = indio_dev->buffer;
>
>         if (!indio_dev->info)
> -               return -ENODEV;
> +               return 0;
>
>         poll_wait(filp, &rb->pollq, wait);
>         if (iio_buffer_ready(indio_dev, rb, rb->watermark, 0))
> --
> 1.9.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web