projects
/
firefly-linux-kernel-4.4.55.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
MIPS: Stack unwinding while on IRQ stack
[firefly-linux-kernel-4.4.55.git]
/
drivers
/
iio
/
industrialio-buffer.c
diff --git
a/drivers/iio/industrialio-buffer.c
b/drivers/iio/industrialio-buffer.c
index 0f6f63b2026379ffd968a764e3309f8fb792eda5..32bb036069eb032313fa95895c83b3396cd752f3 100644
(file)
--- a/
drivers/iio/industrialio-buffer.c
+++ b/
drivers/iio/industrialio-buffer.c
@@
-107,9
+107,10
@@
ssize_t iio_buffer_read_first_n_outer(struct file *filp, char __user *buf,
{
struct iio_dev *indio_dev = filp->private_data;
struct iio_buffer *rb = indio_dev->buffer;
{
struct iio_dev *indio_dev = filp->private_data;
struct iio_buffer *rb = indio_dev->buffer;
+ DEFINE_WAIT_FUNC(wait, woken_wake_function);
size_t datum_size;
size_t to_wait;
size_t datum_size;
size_t to_wait;
- int ret;
+ int ret
= 0
;
if (!indio_dev->info)
return -ENODEV;
if (!indio_dev->info)
return -ENODEV;
@@
-131,19
+132,29
@@
ssize_t iio_buffer_read_first_n_outer(struct file *filp, char __user *buf,
else
to_wait = min_t(size_t, n / datum_size, rb->watermark);
else
to_wait = min_t(size_t, n / datum_size, rb->watermark);
+ add_wait_queue(&rb->pollq, &wait);
do {
do {
- ret = wait_event_interruptible(rb->pollq,
-
iio_buffer_ready(indio_dev, rb, to_wait, n / datum_size))
;
- if (ret)
- return ret;
+ if (!indio_dev->info) {
+
ret = -ENODEV
;
+ break;
+ }
- if (!indio_dev->info)
- return -ENODEV;
+ if (!iio_buffer_ready(indio_dev, rb, to_wait, n / datum_size)) {
+ if (signal_pending(current)) {
+ ret = -ERESTARTSYS;
+ break;
+ }
+
+ wait_woken(&wait, TASK_INTERRUPTIBLE,
+ MAX_SCHEDULE_TIMEOUT);
+ continue;
+ }
ret = rb->access->read_first_n(rb, n, buf);
if (ret == 0 && (filp->f_flags & O_NONBLOCK))
ret = -EAGAIN;
ret = rb->access->read_first_n(rb, n, buf);
if (ret == 0 && (filp->f_flags & O_NONBLOCK))
ret = -EAGAIN;
- } while (ret == 0);
+ } while (ret == 0);
+ remove_wait_queue(&rb->pollq, &wait);
return ret;
}
return ret;
}