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

From: Linus Walleij
Date: Sat Aug 06 2016 - 18:17:32 EST


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@xxxxxxxxxx>
Cc: Marc Zyngier <marc.zyngier@xxxxxxx>
Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: John Stultz <john.stultz@xxxxxxxxxx>
Cc: BjÃrn Andersson <bjorn.andersson@xxxxxxxxxx>
Cc: Stephen Boyd <sboyd@xxxxxxxxxxxxxx>
Cc: Abhijeet Dharmapurikar <adharmap@xxxxxxxxxxxxxx>
Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
---
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(-)

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);
--
2.7.4