diff options
author | Patrick Wildt <patrick@cvs.openbsd.org> | 2021-12-23 20:48:25 +0000 |
---|---|---|
committer | Patrick Wildt <patrick@cvs.openbsd.org> | 2021-12-23 20:48:25 +0000 |
commit | efc87d7d5954535b43fbe94053c35b41975b19b0 (patch) | |
tree | 6d890878d4cc3dcbd03a5930dadbc433cc34b21c /sys/arch | |
parent | f25cbbf5435cd075c48b82a8f6ad1ea841d3e7a2 (diff) |
Fix endless loop in the interrupt handler. When iterating over each
GPIO base register we must not replace the iterator variable with the
index of the pin inside the register.
ok kettenis@
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/arm64/dev/aplpinctrl.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/arch/arm64/dev/aplpinctrl.c b/sys/arch/arm64/dev/aplpinctrl.c index d1c2cf6b841..a090585fbf2 100644 --- a/sys/arch/arm64/dev/aplpinctrl.c +++ b/sys/arch/arm64/dev/aplpinctrl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aplpinctrl.c,v 1.2 2021/10/30 14:50:54 kettenis Exp $ */ +/* $OpenBSD: aplpinctrl.c,v 1.3 2021/12/23 20:48:24 patrick Exp $ */ /* * Copyright (c) 2021 Mark Kettenis <kettenis@openbsd.org> * @@ -266,15 +266,15 @@ aplpinctrl_intr(void *arg) struct aplpinctrl_softc *sc = arg; struct intrhand *ih; uint32_t status, pending; - int pin, s; + int base, pin, s; - for (pin = 0; pin < sc->sc_ngpios; pin += 32) { - status = HREAD4(sc, GPIO_IRQ(0, pin)); + for (base = 0; base < sc->sc_ngpios; base += 32) { + status = HREAD4(sc, GPIO_IRQ(0, base)); pending = status; while (pending) { pin = ffs(pending) - 1; - ih = sc->sc_handler[pin]; + ih = sc->sc_handler[base + pin]; if (ih) { s = splraise(ih->ih_ipl); @@ -286,7 +286,7 @@ aplpinctrl_intr(void *arg) pending &= ~(1 << pin); } - HWRITE4(sc, GPIO_IRQ(0, pin), status); + HWRITE4(sc, GPIO_IRQ(0, base), status); } return 1; |