aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Turner <andrew@FreeBSD.org>2023-06-27 08:32:12 +0000
committerAndrew Turner <andrew@FreeBSD.org>2023-09-25 08:41:32 +0000
commitffe9a1987bb7d57b21bb19e20fd9f66dd98e7a78 (patch)
tree1d63354742d9bcfb5a2ce27017229433614e7966
parent0fb5ae0c7c3d8adf4d1e0d8badf7e724db279f8a (diff)
downloadsrc-ffe9a1987bb7d57b21bb19e20fd9f66dd98e7a78.tar.gz
src-ffe9a1987bb7d57b21bb19e20fd9f66dd98e7a78.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 (cherry picked from commit 9beb195fd9fdc4beb7d5bca865cf5b19ccd7449b)
-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 02da0b884535..cb7a8647e433 100644
--- a/sys/kern/subr_intr.c
+++ b/sys/kern/subr_intr.c
@@ -1715,6 +1715,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 */