The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Salah Triki <salah.triki@gmail.com>
To: "Jonathan Cameron" <jic23@kernel.org>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	Salah Triki <salah.triki@gmail.com>
Subject: [PATCH] iio: proximity: vcnl3020: fix ISR bitmask check in IRQ handler
Date: Wed, 19 Aug 2026 21:37:33 +0100	[thread overview]
Message-ID: <20260819203733.12730-1-salah.triki@gmail.com> (raw)

In vcnl3020_handle_irq_thread(), the status register (VCNL_ISR) was
incorrectly checked against VCNL_ICR_THRES_EN (BIT(1)), which is a bit
mask intended for the Interrupt Control Register (VCNL_PS_ICR).

Because BIT(1) in the ISR register corresponds only to VCNL_INT_TH_LOW,
any high-threshold interrupt (VCNL_INT_TH_HI, BIT(0)) occurring on its own
resulted in the handler returning IRQ_NONE and ignoring the event.

Fix this by checking the ISR value against both valid status bits:
VCNL_INT_TH_HI and VCNL_INT_TH_LOW.

Fixes: 3363fbbe19e5 ("iio: proximity: vcnl3020: add periodic mode")
Signed-off-by: Salah Triki <salah.triki@gmail.com>
---
 drivers/iio/proximity/vcnl3020.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/proximity/vcnl3020.c b/drivers/iio/proximity/vcnl3020.c
index 7f417372566a..d4ad06f8f366 100644
--- a/drivers/iio/proximity/vcnl3020.c
+++ b/drivers/iio/proximity/vcnl3020.c
@@ -584,7 +584,7 @@ static irqreturn_t vcnl3020_handle_irq_thread(int irq, void *p)
 		return IRQ_HANDLED;
 	}
 
-	if (!(isr & VCNL_ICR_THRES_EN))
+	if (!(isr & (VCNL_INT_TH_HI | VCNL_INT_TH_LOW)))
 		return IRQ_NONE;
 
 	iio_push_event(indio_dev,
-- 
2.43.0


             reply	other threads:[~2026-08-19 20:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-19 20:37 Salah Triki [this message]
2026-08-23 21:50 ` [PATCH] iio: proximity: vcnl3020: fix ISR bitmask check in IRQ handler 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=20260819203733.12730-1-salah.triki@gmail.com \
    --to=salah.triki@gmail.com \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --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