All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] iio: ltr501: Don't return error code in trigger handler
@ 2021-10-24 17:12 Lars-Peter Clausen
  2021-10-24 17:12 ` [PATCH 2/3] iio: kxsd9: " Lars-Peter Clausen
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Lars-Peter Clausen @ 2021-10-24 17:12 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Tiberiu Breana, Linus Walleij, Peter Meerwald-Stadler, linux-iio,
	Lars-Peter Clausen

IIO trigger handlers need to return one of the irqreturn_t values.
Returning an error code is not supported.

The ltr501 interrupt handler gets this right for most error paths, but
there is one case where it returns the error code.

In addition for this particular case the trigger handler does not call
`iio_trigger_notify_done()`. Which when not done keeps the triggered
disabled forever.

Modify the code so that the function returns a valid irqreturn_t value as
well as calling `iio_trigger_notify_done()` on all exit paths.

Fixes: 2690be905123 ("iio: Add Lite-On ltr501 ambient light / proximity sensor driver")
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 drivers/iio/light/ltr501.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/light/ltr501.c b/drivers/iio/light/ltr501.c
index 7e51aaac0bf8..b2983b1a9ed1 100644
--- a/drivers/iio/light/ltr501.c
+++ b/drivers/iio/light/ltr501.c
@@ -1275,7 +1275,7 @@ static irqreturn_t ltr501_trigger_handler(int irq, void *p)
 		ret = regmap_bulk_read(data->regmap, LTR501_ALS_DATA1,
 				       als_buf, sizeof(als_buf));
 		if (ret < 0)
-			return ret;
+			goto done;
 		if (test_bit(0, indio_dev->active_scan_mask))
 			scan.channels[j++] = le16_to_cpu(als_buf[1]);
 		if (test_bit(1, indio_dev->active_scan_mask))
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-10-28 14:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-24 17:12 [PATCH 1/3] iio: ltr501: Don't return error code in trigger handler Lars-Peter Clausen
2021-10-24 17:12 ` [PATCH 2/3] iio: kxsd9: " Lars-Peter Clausen
2021-10-25  0:05   ` Linus Walleij
2021-10-24 17:12 ` [PATCH 3/3] iio: stk3310: Don't return error code in interrupt handler Lars-Peter Clausen
2021-10-28 14:05 ` [PATCH 1/3] iio: ltr501: Don't return error code in trigger handler Jonathan Cameron

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.