This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new ec243f0f6b icjx: disable interrupts in interrupt worker
ec243f0f6b is described below
commit ec243f0f6b960b702f0b2bb9afcfd46e80650a36
Author: Michal Lenc <[email protected]>
AuthorDate: Wed Nov 13 16:41:33 2024 +0100
icjx: disable interrupts in interrupt worker
Interrupts have to be disabled if interrupt worker processes them,
otherwise assertion may occur as another interrupt tries to queue
worker that is not available (because it processes previous interrupts).
Interrupts are re-enabled after the worker leaves the loop processing
previous interrupts.
Signed-off-by: Michal Lenc <[email protected]>
---
drivers/ioexpander/icjx.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/ioexpander/icjx.c b/drivers/ioexpander/icjx.c
index dd9222f6fc..16adfcc621 100644
--- a/drivers/ioexpander/icjx.c
+++ b/drivers/ioexpander/icjx.c
@@ -950,6 +950,12 @@ static void icjx_interrupt_worker(void *arg)
ioe_pinset_t irq_match;
int ret;
+ /* Disable interrupts. All newly incoming interrupts are handled in
+ * a while loop if there is something to handle.
+ */
+
+ priv->config->enable(priv->config, false);
+
/* Read interrupt status register */
icjx_read(priv, ICJX_INT_STATUS_A, &isr, ICJX_NOB2);
@@ -977,6 +983,10 @@ static void icjx_interrupt_worker(void *arg)
icjx_write(priv, ICJX_CTRL_WORD_4, ICJX_CTRL_WORD_4_EOI, ICJX_NOB1);
icjx_read(priv, ICJX_INT_STATUS_A, &isr, ICJX_NOB2);
}
+
+ /* And enable interrupts again. */
+
+ priv->config->enable(priv->config, true);
}
/****************************************************************************