]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ACPI: RISC-V: Create interrupt controller list in sorted order
authorSunil V L <sunilvl@ventanamicro.com>
Mon, 18 Aug 2025 04:09:13 +0000 (09:39 +0530)
committerPaul Walmsley <pjw@kernel.org>
Fri, 26 Sep 2025 01:48:52 +0000 (19:48 -0600)
Currently, the interrupt controller list is created without any order.
Create the list sorted with the GSI base of the interrupt controllers.

Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Acked-by: Jassi Brar <jassisinghbrar@gmail.com>
Link: https://lore.kernel.org/r/20250818040920.272664-18-apatel@ventanamicro.com
Signed-off-by: Paul Walmsley <pjw@kernel.org>
drivers/acpi/riscv/irq.c

index cced960c2aeff21f6442657e6822572d29660522..33c073e2e71d94fbc86539265a2cb355c4f578ec 100644 (file)
@@ -115,7 +115,7 @@ struct fwnode_handle *riscv_acpi_get_gsi_domain_id(u32 gsi)
 static int __init riscv_acpi_register_ext_intc(u32 gsi_base, u32 nr_irqs, u32 nr_idcs,
                                               u32 id, u32 type)
 {
-       struct riscv_ext_intc_list *ext_intc_element;
+       struct riscv_ext_intc_list *ext_intc_element, *node;
 
        ext_intc_element = kzalloc(sizeof(*ext_intc_element), GFP_KERNEL);
        if (!ext_intc_element)
@@ -125,7 +125,12 @@ static int __init riscv_acpi_register_ext_intc(u32 gsi_base, u32 nr_irqs, u32 nr
        ext_intc_element->nr_irqs = nr_irqs;
        ext_intc_element->nr_idcs = nr_idcs;
        ext_intc_element->id = id;
-       list_add_tail(&ext_intc_element->list, &ext_intc_list);
+       list_for_each_entry(node, &ext_intc_list, list) {
+               if (node->gsi_base < ext_intc_element->gsi_base)
+                       break;
+       }
+
+       list_add_tail(&ext_intc_element->list, &node->list);
        return 0;
 }