gpio: Move irq_default_type to struct gpio_irq_chip
authorThierry Reding <treding@nvidia.com>
Tue, 7 Nov 2017 18:15:49 +0000 (19:15 +0100)
committerLinus Walleij <linus.walleij@linaro.org>
Wed, 8 Nov 2017 13:08:05 +0000 (14:08 +0100)
In order to consolidate the multiple ways to associate an IRQ chip with
a GPIO chip, move more fields into the new struct gpio_irq_chip.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Acked-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpiolib.c
include/linux/gpio/driver.h

index dafbca1..d3608cf 100644 (file)
@@ -1656,8 +1656,8 @@ static int gpiochip_irq_map(struct irq_domain *d, unsigned int irq,
         * 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);
+       if (chip->irq.default_type != IRQ_TYPE_NONE)
+               irq_set_irq_type(irq, chip->irq.default_type);
 
        return 0;
 }
@@ -1821,7 +1821,7 @@ int gpiochip_irqchip_add_key(struct gpio_chip *gpiochip,
 
        gpiochip->irq.chip = irqchip;
        gpiochip->irq.handler = handler;
-       gpiochip->irq_default_type = type;
+       gpiochip->irq.default_type = type;
        gpiochip->to_irq = gpiochip_to_irq;
        gpiochip->lock_key = lock_key;
        gpiochip->irq.domain = irq_domain_add_simple(of_node,
index 864f507..1367fa9 100644 (file)
@@ -55,6 +55,14 @@ struct gpio_irq_chip {
        irq_flow_handler_t handler;
 
        /**
+        * @default_type:
+        *
+        * Default IRQ triggering type applied during GPIO driver
+        * initialization, provided by GPIO driver.
+        */
+       unsigned int default_type;
+
+       /**
         * @parent_handler:
         *
         * The interrupt handler for the GPIO chip's parent interrupts, may be
@@ -140,8 +148,6 @@ static inline struct gpio_irq_chip *to_gpio_irq_chip(struct irq_chip *chip)
  *     safely.
  * @bgpio_dir: shadowed direction register for generic GPIO to clear/set
  *     direction safely.
- * @irq_default_type: default IRQ triggering type applied during GPIO driver
- *     initialization, provided by GPIO driver
  * @irq_chained_parent: GPIO IRQ chip parent/bank linux irq number,
  *     provided by GPIO driver for chained interrupt (not for nested
  *     interrupts).
@@ -220,7 +226,6 @@ struct gpio_chip {
         * With CONFIG_GPIOLIB_IRQCHIP we get an irqchip inside the gpiolib
         * to handle IRQs for most practical cases.
         */
-       unsigned int            irq_default_type;
        unsigned int            irq_chained_parent;
        bool                    irq_nested;
        bool                    irq_need_valid_mask;