Some GPIO irqchip drivers exploit the irqdomain mapping
function to set up the IRQ default type in the hardware,
make sure that if we pass IRQ_TYPE_NONE, no hardware setup
whatsoever takes place (this should be the norm) until
later when the IRQ gets utilized.

Cc: Nishanth Menon <n...@ti.com>
Cc: Peter Ujfalusi <peter.ujfal...@ti.com>
Cc: Ezequiel Garcia <ezequiel.gar...@free-electrons.com>
Cc: Javier Martinez Canillas <jav...@dowhile0.org>
Cc: Tony Lindgren <t...@atomide.com>
Cc: Santosh Shilimkar <santosh.shilim...@ti.com>
Cc: linux-omap <linux-omap@vger.kernel.org>
Signed-off-by: Linus Walleij <linus.wall...@linaro.org>
---
TI folks: can you provide a Tested-by tag if this makes your
OMAPs work? I am pretty sure the other platforms will be
unaffected, if they aren't I will switch them over to react
to IRQ_TYPE_DEFAULT.
---
 drivers/gpio/gpiolib.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index ee1819fdcf35..97d173e9aa2d 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -1409,7 +1409,12 @@ static int gpiochip_irq_map(struct irq_domain *d, 
unsigned int irq,
 #else
        irq_set_noprobe(irq);
 #endif
-       irq_set_irq_type(irq, chip->irq_default_type);
+       /*
+        * No set-up of the hardware will happen if IRQ_TYPE_NONE
+        * is passed as default type.
+        */
+       if (chip->irq_default_type != IRQ_TYPE_NONE)
+               irq_set_irq_type(irq, chip->irq_default_type);
 
        return 0;
 }
@@ -1490,7 +1495,8 @@ static void gpiochip_irqchip_remove(struct gpio_chip 
*gpiochip)
  * @first_irq: if not dynamically assigned, the base (first) IRQ to
  * allocate gpiochip irqs from
  * @handler: the irq handler to use (often a predefined irq core function)
- * @type: the default type for IRQs on this irqchip
+ * @type: the default type for IRQs on this irqchip, pass IRQ_TYPE_NONE
+ * to have the core avoid setting up any default type in the hardware.
  *
  * This function closely associates a certain irqchip with a certain
  * gpiochip, providing an irq domain to translate the local IRQs to
-- 
1.9.0

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to