Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 24bd59ca authored by Yingjoe Chen's avatar Yingjoe Chen Committed by Puja Gupta
Browse files

irqdomain: Do irq_find_mapping and set_type for hierarchy irqdomain in case OF



It is possible to call irq_create_of_mapping to create/translate the
same IRQ from DT for multiple times. Perform irq_find_mapping check
and set_type for hierarchy irqdomain in irq_create_of_mapping() to
avoid duplicate these functionality in all outer most irqdomain.

Signed-off-by: default avatarYingjoe Chen <yingjoe.chen@mediatek.com>
Signed-off-by: default avatarJiang Liu <jiang.liu@linux.intel.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Grant Likely <grant.likely@linaro.org>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Yingjoe Chen <yingjoe.chen@mediatek.com>
Cc: Yijing Wang <wangyijing@huawei.com>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Git-commit: 0cc01abab6412f3a76256bb57ca58dcb94a6edc7
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git


Signed-off-by: default avatarPuja Gupta <pujag@codeaurora.org>
parent d6e0fe39
Loading
Loading
Loading
Loading
+18 −9
Original line number Original line Diff line number Diff line
@@ -478,11 +478,6 @@ unsigned int irq_create_of_mapping(struct of_phandle_args *irq_data)
		return 0;
		return 0;
	}
	}


	if (irq_domain_is_hierarchy(domain)) {
		virq = irq_domain_alloc_irqs(domain, 1, NUMA_NO_NODE, irq_data);
		return virq <= 0 ? 0 : virq;
	}

	/* If domain has no translation, then we assume interrupt line */
	/* If domain has no translation, then we assume interrupt line */
	if (domain->ops->xlate == NULL)
	if (domain->ops->xlate == NULL)
		hwirq = irq_data->args[0];
		hwirq = irq_data->args[0];
@@ -492,10 +487,24 @@ unsigned int irq_create_of_mapping(struct of_phandle_args *irq_data)
			return 0;
			return 0;
	}
	}


	if (irq_domain_is_hierarchy(domain)) {
		/*
		 * If we've already configured this interrupt,
		 * don't do it again, or hell will break loose.
		 */
		virq = irq_find_mapping(domain, hwirq);
		if (virq)
			return virq;

		virq = irq_domain_alloc_irqs(domain, 1, NUMA_NO_NODE, irq_data);
		if (virq <= 0)
			return 0;
	} else {
		/* Create mapping */
		/* Create mapping */
		virq = irq_create_mapping(domain, hwirq);
		virq = irq_create_mapping(domain, hwirq);
		if (!virq)
		if (!virq)
			return virq;
			return virq;
	}


	/* Set type if specified and different than the current one */
	/* Set type if specified and different than the current one */
	if (type != IRQ_TYPE_NONE &&
	if (type != IRQ_TYPE_NONE &&