mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2026-05-23 14:21:32 +01:00
lib: sbi_irqchip: Keep the handler list in sorted order for irqchip
Let's keep the handler list in sorted order for irqchip so that it is easier to allocate unused hardware interrupts based on the sorted list. Signed-off-by: Anup Patel <anup.patel@oss.qualcomm.com> Link: https://lore.kernel.org/r/20260423052339.356900-3-anup.patel@oss.qualcomm.com Signed-off-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
+13
-2
@@ -139,7 +139,7 @@ int sbi_irqchip_register_handler(struct sbi_irqchip_device *chip,
|
|||||||
u32 first_hwirq, u32 num_hwirq,
|
u32 first_hwirq, u32 num_hwirq,
|
||||||
int (*callback)(u32 hwirq, void *opaque), void *priv)
|
int (*callback)(u32 hwirq, void *opaque), void *priv)
|
||||||
{
|
{
|
||||||
struct sbi_irqchip_handler *h;
|
struct sbi_irqchip_handler *h, *th, *nh;
|
||||||
u32 i, j;
|
u32 i, j;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
@@ -162,7 +162,18 @@ int sbi_irqchip_register_handler(struct sbi_irqchip_device *chip,
|
|||||||
h->num_hwirq = num_hwirq;
|
h->num_hwirq = num_hwirq;
|
||||||
h->callback = callback;
|
h->callback = callback;
|
||||||
h->priv = priv;
|
h->priv = priv;
|
||||||
sbi_list_add_tail(&h->node, &chip->handler_list);
|
|
||||||
|
nh = NULL;
|
||||||
|
sbi_list_for_each_entry(th, &chip->handler_list, node) {
|
||||||
|
if (h->first_hwirq < th->first_hwirq) {
|
||||||
|
nh = th;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (nh)
|
||||||
|
sbi_list_add(&h->node, &nh->node);
|
||||||
|
else
|
||||||
|
sbi_list_add_tail(&h->node, &chip->handler_list);
|
||||||
|
|
||||||
if (chip->hwirq_setup) {
|
if (chip->hwirq_setup) {
|
||||||
for (i = 0; i < h->num_hwirq; i++) {
|
for (i = 0; i < h->num_hwirq; i++) {
|
||||||
|
|||||||
Reference in New Issue
Block a user