]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
irqchip/loongson-htvec: Adjust irqchip driver for 32BIT/64BIT
authorHuacai Chen <chenhuacai@loongson.cn>
Tue, 13 Jan 2026 08:59:37 +0000 (16:59 +0800)
committerThomas Gleixner <tglx@kernel.org>
Sun, 18 Jan 2026 13:39:17 +0000 (14:39 +0100)
irq_domain_alloc_fwnode() takes a parameter with the phys_addr_t type.
Currently the code passes acpi_htvec->address to it.

This can only work on 64BIT platform because its type is u64, so cast it to
phys_addr_t and then the driver works on both 32BIT and 64BIT platforms.

[ tglx: Dereference _after_ the NULL pointer check, make the cast explicit
   and use the casted address as argument for htvec_init() which takes
   a phys_addr_t as well. Sigh... ]

Co-developed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Link: https://patch.msgid.link/20260113085940.3344837-5-chenhuacai@loongson.cn
drivers/irqchip/irq-loongson-htvec.c

index d2be8e954e92fd7a2982c5e17780983254f422e9..5a3339da97ad5d1c5976ebab81ecf03622da1e63 100644 (file)
@@ -295,19 +295,19 @@ static int __init acpi_cascade_irqdomain_init(void)
        return 0;
 }
 
-int __init htvec_acpi_init(struct irq_domain *parent,
-                                  struct acpi_madt_ht_pic *acpi_htvec)
+int __init htvec_acpi_init(struct irq_domain *parent, struct acpi_madt_ht_pic *acpi_htvec)
 {
-       int i, ret;
-       int num_parents, parent_irq[8];
+       int i, ret, num_parents, parent_irq[8];
        struct fwnode_handle *domain_handle;
+       phys_addr_t addr;
 
        if (!acpi_htvec)
                return -EINVAL;
 
        num_parents = HTVEC_MAX_PARENT_IRQ;
+       addr = (phys_addr_t)acpi_htvec->address;
 
-       domain_handle = irq_domain_alloc_fwnode(&acpi_htvec->address);
+       domain_handle = irq_domain_alloc_fwnode(&addr);
        if (!domain_handle) {
                pr_err("Unable to allocate domain handle\n");
                return -ENOMEM;
@@ -317,9 +317,7 @@ int __init htvec_acpi_init(struct irq_domain *parent,
        for (i = 0; i < HTVEC_MAX_PARENT_IRQ; i++)
                parent_irq[i] = irq_create_mapping(parent, acpi_htvec->cascade[i]);
 
-       ret = htvec_init(acpi_htvec->address, acpi_htvec->size,
-                       num_parents, parent_irq, domain_handle);
-
+       ret = htvec_init(addr, acpi_htvec->size, num_parents, parent_irq, domain_handle);
        if (ret == 0)
                ret = acpi_cascade_irqdomain_init();
        else