LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] iio: light: opt3001: Fixed timeout error when 0 lux
@ 2021-09-20 12:53 Jiri Valek - 2N
2021-09-26 13:55 ` Jonathan Cameron
0 siblings, 1 reply; 3+ messages in thread
From: Jiri Valek - 2N @ 2021-09-20 12:53 UTC (permalink / raw)
To: jic23
Cc: Jiri Valek - 2N, Lars-Peter Clausen, Gwendal Grignou, linux-iio,
linux-kernel
Reading from sensor returned timeout error under
zero light conditions.
Signed-off-by: Jiri Valek - 2N <valek@2n.cz>
---
drivers/iio/light/opt3001.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/iio/light/opt3001.c b/drivers/iio/light/opt3001.c
index 52963da401a7..1880bd5bb258 100644
--- a/drivers/iio/light/opt3001.c
+++ b/drivers/iio/light/opt3001.c
@@ -276,6 +276,8 @@ static int opt3001_get_lux(struct opt3001 *opt, int *val, int *val2)
ret = wait_event_timeout(opt->result_ready_queue,
opt->result_ready,
msecs_to_jiffies(OPT3001_RESULT_READY_LONG));
+ if (ret == 0)
+ return -ETIMEDOUT;
} else {
/* Sleep for result ready time */
timeout = (opt->int_time == OPT3001_INT_TIME_SHORT) ?
@@ -312,9 +314,7 @@ static int opt3001_get_lux(struct opt3001 *opt, int *val, int *val2)
/* Disallow IRQ to access the device while lock is active */
opt->ok_to_ignore_lock = false;
- if (ret == 0)
- return -ETIMEDOUT;
- else if (ret < 0)
+ if (ret < 0)
return ret;
if (opt->use_irq) {
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] iio: light: opt3001: Fixed timeout error when 0 lux
2021-09-20 12:53 [PATCH] iio: light: opt3001: Fixed timeout error when 0 lux Jiri Valek - 2N
@ 2021-09-26 13:55 ` Jonathan Cameron
2021-10-03 15:43 ` Jonathan Cameron
0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Cameron @ 2021-09-26 13:55 UTC (permalink / raw)
To: Jiri Valek - 2N
Cc: Lars-Peter Clausen, Gwendal Grignou, linux-iio, linux-kernel,
Alexander Koch, Andreas Dannenberg
On Mon, 20 Sep 2021 14:53:48 +0200
Jiri Valek - 2N <valek@2n.cz> wrote:
> Reading from sensor returned timeout error under
> zero light conditions.
>
> Signed-off-by: Jiri Valek - 2N <valek@2n.cz>
Hi Jiri,
Thanks for this. Looks good to me though I'll leave a little longer for others
to take a look.
Does need a fixes tag though so we know how far to backport it.
I think it should be
Fixes: ac663db3678a ("iio: light: opt3001: enable operation w/o IRQ")
+Cc Alexander and Andreas
> ---
> drivers/iio/light/opt3001.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/iio/light/opt3001.c b/drivers/iio/light/opt3001.c
> index 52963da401a7..1880bd5bb258 100644
> --- a/drivers/iio/light/opt3001.c
> +++ b/drivers/iio/light/opt3001.c
> @@ -276,6 +276,8 @@ static int opt3001_get_lux(struct opt3001 *opt, int *val, int *val2)
> ret = wait_event_timeout(opt->result_ready_queue,
> opt->result_ready,
> msecs_to_jiffies(OPT3001_RESULT_READY_LONG));
> + if (ret == 0)
> + return -ETIMEDOUT;
> } else {
> /* Sleep for result ready time */
> timeout = (opt->int_time == OPT3001_INT_TIME_SHORT) ?
> @@ -312,9 +314,7 @@ static int opt3001_get_lux(struct opt3001 *opt, int *val, int *val2)
> /* Disallow IRQ to access the device while lock is active */
> opt->ok_to_ignore_lock = false;
>
> - if (ret == 0)
> - return -ETIMEDOUT;
> - else if (ret < 0)
> + if (ret < 0)
> return ret;
>
> if (opt->use_irq) {
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] iio: light: opt3001: Fixed timeout error when 0 lux
2021-09-26 13:55 ` Jonathan Cameron
@ 2021-10-03 15:43 ` Jonathan Cameron
0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2021-10-03 15:43 UTC (permalink / raw)
To: Jiri Valek - 2N
Cc: Lars-Peter Clausen, Gwendal Grignou, linux-iio, linux-kernel,
Alexander Koch, Andreas Dannenberg
On Sun, 26 Sep 2021 14:55:14 +0100
Jonathan Cameron <jic23@kernel.org> wrote:
> On Mon, 20 Sep 2021 14:53:48 +0200
> Jiri Valek - 2N <valek@2n.cz> wrote:
>
> > Reading from sensor returned timeout error under
> > zero light conditions.
> >
> > Signed-off-by: Jiri Valek - 2N <valek@2n.cz>
> Hi Jiri,
>
> Thanks for this. Looks good to me though I'll leave a little longer for others
> to take a look.
>
> Does need a fixes tag though so we know how far to backport it.
> I think it should be
>
> Fixes: ac663db3678a ("iio: light: opt3001: enable operation w/o IRQ")
>
> +Cc Alexander and Andreas
Applied to the fixes-togreg branch of iio.git and marked for stable.
Thanks,
Jonathan
>
> > ---
> > drivers/iio/light/opt3001.c | 6 +++---
> > 1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/iio/light/opt3001.c b/drivers/iio/light/opt3001.c
> > index 52963da401a7..1880bd5bb258 100644
> > --- a/drivers/iio/light/opt3001.c
> > +++ b/drivers/iio/light/opt3001.c
> > @@ -276,6 +276,8 @@ static int opt3001_get_lux(struct opt3001 *opt, int *val, int *val2)
> > ret = wait_event_timeout(opt->result_ready_queue,
> > opt->result_ready,
> > msecs_to_jiffies(OPT3001_RESULT_READY_LONG));
> > + if (ret == 0)
> > + return -ETIMEDOUT;
> > } else {
> > /* Sleep for result ready time */
> > timeout = (opt->int_time == OPT3001_INT_TIME_SHORT) ?
> > @@ -312,9 +314,7 @@ static int opt3001_get_lux(struct opt3001 *opt, int *val, int *val2)
> > /* Disallow IRQ to access the device while lock is active */
> > opt->ok_to_ignore_lock = false;
> >
> > - if (ret == 0)
> > - return -ETIMEDOUT;
> > - else if (ret < 0)
> > + if (ret < 0)
> > return ret;
> >
> > if (opt->use_irq) {
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-10-03 15:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-20 12:53 [PATCH] iio: light: opt3001: Fixed timeout error when 0 lux Jiri Valek - 2N
2021-09-26 13:55 ` Jonathan Cameron
2021-10-03 15:43 ` Jonathan Cameron
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).