diff mbox

Revert "irqdomain: Don't set type when mapping an IRQ"

Message ID 1470471483-1432-1-git-send-email-linus.walleij@linaro.org
State New
Headers show

Commit Message

Linus Walleij Aug. 6, 2016, 8:18 a.m. UTC
This reverts commit 1e2a7d78499ec8859d2b469051b7b80bad3b08aa.

When using the APQ8060 Dragonboard I have lost all interrupts from
the PMIC after this commit: power button, keypad, RTC alarm and
all GPIOs. Reverting the commit solves the issue.

The affected irqchip driver is drivers/mfd/pm8921-core.c

I cannot immediately see what the problem is, so if you have a
better solution than just reverting the patch, please suggest.

Cc: Jon Hunter <jonathanh@nvidia.com>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Stultz <john.stultz@linaro.org>
Cc: Björn Andersson <bjorn.andersson@linaro.org>
Cc: Stephen Boyd <sboyd@codeaurora.org>
Cc: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

---
I am pretty sure that this is the same bug that John Stultz is
seeing on the Nexus 7, John: please confirm.
---
 include/linux/irqdomain.h |  3 ---
 kernel/irq/irqdomain.c    | 23 +++++------------------
 2 files changed, 5 insertions(+), 21 deletions(-)

-- 
2.7.4
diff mbox

Patch

diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
index ffb84604c1de..1aee0fbe900e 100644
--- a/include/linux/irqdomain.h
+++ b/include/linux/irqdomain.h
@@ -455,9 +455,6 @@  static inline int irq_domain_alloc_irqs(struct irq_domain *domain,
 	return -1;
 }
 
-static inline void irq_domain_free_irqs(unsigned int virq,
-					unsigned int nr_irqs) { }
-
 static inline bool irq_domain_is_hierarchy(struct irq_domain *domain)
 {
 	return false;
diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
index 4752b43662e0..9ba6a6ec4408 100644
--- a/kernel/irq/irqdomain.c
+++ b/kernel/irq/irqdomain.c
@@ -567,7 +567,6 @@  static void of_phandle_args_to_fwspec(struct of_phandle_args *irq_data,
 unsigned int irq_create_fwspec_mapping(struct irq_fwspec *fwspec)
 {
 	struct irq_domain *domain;
-	struct irq_data *irq_data;
 	irq_hw_number_t hwirq;
 	unsigned int type = IRQ_TYPE_NONE;
 	int virq;
@@ -615,11 +614,7 @@  unsigned int irq_create_fwspec_mapping(struct irq_fwspec *fwspec)
 		 * it now and return the interrupt number.
 		 */
 		if (irq_get_trigger_type(virq) == IRQ_TYPE_NONE) {
-			irq_data = irq_get_irq_data(virq);
-			if (!irq_data)
-				return 0;
-
-			irqd_set_trigger_type(irq_data, type);
+			irq_set_irq_type(virq, type);
 			return virq;
 		}
 
@@ -639,18 +634,10 @@  unsigned int irq_create_fwspec_mapping(struct irq_fwspec *fwspec)
 			return virq;
 	}
 
-	irq_data = irq_get_irq_data(virq);
-	if (!irq_data) {
-		if (irq_domain_is_hierarchy(domain))
-			irq_domain_free_irqs(virq, 1);
-		else
-			irq_dispose_mapping(virq);
-		return 0;
-	}
-
-	/* Store trigger type */
-	irqd_set_trigger_type(irq_data, type);
-
+	/* Set type if specified and different than the current one */
+	if (type != IRQ_TYPE_NONE &&
+	    type != irq_get_trigger_type(virq))
+		irq_set_irq_type(virq, type);
 	return virq;
 }
 EXPORT_SYMBOL_GPL(irq_create_fwspec_mapping);