aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Turner <andrew@FreeBSD.org>2023-06-27 08:32:12 +0000
committerAndrew Turner <andrew@FreeBSD.org>2023-06-28 17:03:08 +0000
commit9beb195fd9fdc4beb7d5bca865cf5b19ccd7449b (patch)
treeda49ba79f7649596140a5c0c136bd12a4a933f9f
parent1e0ba9d43cf035c63b8e525606ca5bc89f3b22a4 (diff)
downloadsrc-9beb195fd9fdc4beb7d5bca865cf5b19ccd7449b.tar.gz
src-9beb195fd9fdc4beb7d5bca865cf5b19ccd7449b.zip
Continue searching for an irq map from the start
When searching for a free irq map location continue the search from the beginning of the list. There may be holes in the map before irq_map_first_free_idx, e.g. when removing an entries in order will increase the index past the current free entry. PR: 271990 Reviewed by: mhorne Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D40768
-rw-r--r--sys/kern/subr_intr.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/kern/subr_intr.c b/sys/kern/subr_intr.c
index 5c7c99f458c1..ab882209c1e3 100644
--- a/sys/kern/subr_intr.c
+++ b/sys/kern/subr_intr.c
@@ -1720,6 +1720,14 @@ intr_map_irq(device_t dev, intptr_t xref, struct intr_map_data *data)
return (i);
}
}
+ for (i = 0; i < irq_map_first_free_idx; i++) {
+ if (irq_map[i] == NULL) {
+ irq_map[i] = entry;
+ irq_map_first_free_idx = i + 1;
+ mtx_unlock(&irq_map_lock);
+ return (i);
+ }
+ }
mtx_unlock(&irq_map_lock);
/* XXX Expand irq_map table */