gpio: kill off set_irq_flags usage
authorRob Herring <robh@kernel.org>
Mon, 27 Jul 2015 20:55:16 +0000 (15:55 -0500)
committerLinus Walleij <linus.walleij@linaro.org>
Tue, 28 Jul 2015 07:45:39 +0000 (09:45 +0200)
set_irq_flags is ARM specific with custom flags which have genirq
equivalents. Convert drivers to use the genirq interfaces directly, so we
can kill off set_irq_flags. The translation of flags is as follows:

IRQF_VALID -> !IRQ_NOREQUEST
IRQF_PROBE -> !IRQ_NOPROBE
IRQF_NOAUTOEN -> IRQ_NOAUTOEN

For IRQs managed by an irqdomain, the irqdomain core code handles clearing
and setting IRQ_NOREQUEST already, so there is no need to do this in
.map() functions and we can simply remove the set_irq_flags calls. Some
users also modify IRQ_NOPROBE and this has been maintained although it
is not clear that is really needed as most platforms don't use probing.
There appears to be a great deal of blind copy and paste of this code.

Signed-off-by: Rob Herring <robh@kernel.org>
Cc: Michael Hennerich <michael.hennerich@analog.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Cc: Alexandre Courbot <gnurou@gmail.com>
Cc: Ray Jui <rjui@broadcom.com>
Cc: Stephen Warren <swarren@wwwdotorg.org>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: linux-gpio@vger.kernel.org
Cc: bcm-kernel-feedback-list@broadcom.com
Cc: linux-tegra@vger.kernel.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
14 files changed:
drivers/gpio/gpio-adp5588.c
drivers/gpio/gpio-bcm-kona.c
drivers/gpio/gpio-davinci.c
drivers/gpio/gpio-em.c
drivers/gpio/gpio-ep93xx.c
drivers/gpio/gpio-grgpio.c
drivers/gpio/gpio-mcp23s08.c
drivers/gpio/gpio-msm-v2.c
drivers/gpio/gpio-pxa.c
drivers/gpio/gpio-sa1100.c
drivers/gpio/gpio-sta2x11.c
drivers/gpio/gpio-tegra.c
drivers/gpio/gpio-timberdale.c
drivers/gpio/gpiolib.c

index d3fe6a6776daaa8c43023daba09f3008187c471d..984186ee58a099f6c5aa16fda7666fd4e28870a4 100644 (file)
@@ -305,15 +305,7 @@ static int adp5588_irq_setup(struct adp5588_gpio *dev)
                irq_set_chip_and_handler(irq, &adp5588_irq_chip,
                                         handle_level_irq);
                irq_set_nested_thread(irq, 1);
-#ifdef CONFIG_ARM
-               /*
-                * ARM needs us to explicitly flag the IRQ as VALID,
-                * once we do so, it will also set the noprobe.
-                */
-               set_irq_flags(irq, IRQF_VALID);
-#else
-               irq_set_noprobe(irq);
-#endif
+               irq_modify_status(irq, IRQ_NOREQUEST, IRQ_NOPROBE);
        }
 
        ret = request_threaded_irq(client->irq,
index 109083f65248694c4f06dfbe4d16788562f3a49b..31b90ac15204b9bf987f0cfc5e454ff90637dc78 100644 (file)
@@ -525,11 +525,7 @@ static int bcm_kona_gpio_irq_map(struct irq_domain *d, unsigned int irq,
                return ret;
        irq_set_lockdep_class(irq, &gpio_lock_class);
        irq_set_chip_and_handler(irq, &bcm_gpio_irq_chip, handle_simple_irq);
-#ifdef CONFIG_ARM
-       set_irq_flags(irq, IRQF_VALID);
-#else
        irq_set_noprobe(irq);
-#endif
 
        return 0;
 }
@@ -644,17 +640,6 @@ static int bcm_kona_gpio_probe(struct platform_device *pdev)
                dev_err(dev, "Couldn't add GPIO chip -- %d\n", ret);
                goto err_irq_domain;
        }
-       for (i = 0; i < chip->ngpio; i++) {
-               int irq = bcm_kona_gpio_to_irq(chip, i);
-               irq_set_lockdep_class(irq, &gpio_lock_class);
-               irq_set_chip_and_handler(irq, &bcm_gpio_irq_chip,
-                                        handle_simple_irq);
-#ifdef CONFIG_ARM
-               set_irq_flags(irq, IRQF_VALID);
-#else
-               irq_set_noprobe(irq);
-#endif
-       }
        for (i = 0; i < kona_gpio->num_bank; i++) {
                bank = &kona_gpio->banks[i];
                irq_set_chained_handler_and_data(bank->irq,
index 7be269402bafe4a3fb226021a8bacdaa5f65b492..94b0ab7097216560c5b867663425bd1f5ad04d92 100644 (file)
@@ -423,7 +423,6 @@ davinci_gpio_irq_map(struct irq_domain *d, unsigned int irq,
        irq_set_irq_type(irq, IRQ_TYPE_NONE);
        irq_set_chip_data(irq, (__force void *)g);
        irq_set_handler_data(irq, (void *)__gpio_mask(hw));
-       set_irq_flags(irq, IRQF_VALID);
 
        return 0;
 }
index a77f16c8d1422db3508af553b38824d4020e2b7d..6bca1e125e1234b8e38f069f7e5b1ef6395b3cff 100644 (file)
@@ -261,7 +261,6 @@ static int em_gio_irq_domain_map(struct irq_domain *h, unsigned int irq,
 
        irq_set_chip_data(irq, h->host_data);
        irq_set_chip_and_handler(irq, &p->irq_chip, handle_level_irq);
-       set_irq_flags(irq, IRQF_VALID); /* kill me now */
        return 0;
 }
 
index dc0c40935940400686a626a71782c9b14de4ff26..9d90366ea2599920f64556caa38cc225b3296b83 100644 (file)
@@ -236,7 +236,7 @@ static void ep93xx_gpio_init_irq(void)
             gpio_irq <= gpio_to_irq(EP93XX_GPIO_LINE_MAX_IRQ); ++gpio_irq) {
                irq_set_chip_and_handler(gpio_irq, &ep93xx_gpio_irq_chip,
                                         handle_level_irq);
-               set_irq_flags(gpio_irq, IRQF_VALID);
+               irq_clear_status_flags(gpio_irq, IRQ_NOREQUEST);
        }
 
        irq_set_chained_handler(IRQ_EP93XX_GPIO_AB,
index 0a8f7617e72e99d413439c072e8a185cecae83e4..77053d61466e790c07b31d8133b9d903fd3f0e19 100644 (file)
@@ -281,12 +281,7 @@ static int grgpio_irq_map(struct irq_domain *d, unsigned int irq,
        irq_set_chip_data(irq, priv);
        irq_set_chip_and_handler(irq, &grgpio_irq_chip,
                                 handle_simple_irq);
-       irq_clear_status_flags(irq, IRQ_NOREQUEST);
-#ifdef CONFIG_ARM
-       set_irq_flags(irq, IRQF_VALID);
-#else
        irq_set_noprobe(irq);
-#endif
 
        return ret;
 }
@@ -301,9 +296,6 @@ static void grgpio_irq_unmap(struct irq_domain *d, unsigned int irq)
        int ngpio = priv->bgc.gc.ngpio;
        int i;
 
-#ifdef CONFIG_ARM
-       set_irq_flags(irq, 0);
-#endif
        irq_set_chip_and_handler(irq, NULL, NULL);
        irq_set_chip_data(irq, NULL);
 
index 2fc7ff852d1676d728e150d9a27e37e02403f72f..73db7ecd7ffd9c2e44bc0a98af639884ee6fb9ad 100644 (file)
@@ -507,11 +507,7 @@ static int mcp23s08_irq_setup(struct mcp23s08 *mcp)
                irq_set_chip_data(irq, mcp);
                irq_set_chip(irq, &mcp23s08_irq_chip);
                irq_set_nested_thread(irq, true);
-#ifdef CONFIG_ARM
-               set_irq_flags(irq, IRQF_VALID);
-#else
                irq_set_noprobe(irq);
-#endif
        }
        return 0;
 }
index 1f0fb19209bf9fac442b959922ac28c20d020e31..d2012cfb5571819f6b6e4526c40625e9e94d8076 100644 (file)
@@ -355,7 +355,6 @@ static int msm_gpio_irq_domain_map(struct irq_domain *d, unsigned int irq,
        irq_set_lockdep_class(irq, &msm_gpio_lock_class);
        irq_set_chip_and_handler(irq, &msm_gpio_irq_chip,
                        handle_level_irq);
-       set_irq_flags(irq, IRQF_VALID);
 
        return 0;
 }
index cdbbcf0faf9da4a263504f7a7b0cc3d8aabc8cdb..55a11de3d5b741f1038fd4b50fb9300cc8be7813 100644 (file)
@@ -524,7 +524,7 @@ static int pxa_irq_domain_map(struct irq_domain *d, unsigned int irq,
 {
        irq_set_chip_and_handler(irq, &pxa_muxed_gpio_chip,
                                 handle_edge_irq);
-       set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
+       irq_set_noprobe(irq);
        return 0;
 }
 
@@ -643,20 +643,20 @@ static int pxa_gpio_probe(struct platform_device *pdev)
                        irq = gpio_to_irq(0);
                        irq_set_chip_and_handler(irq, &pxa_muxed_gpio_chip,
                                                 handle_edge_irq);
-                       set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
+                       irq_clear_status_flags(irq, IRQ_NOREQUEST | IRQ_NOPROBE);
                }
                if (irq1 > 0) {
                        irq = gpio_to_irq(1);
                        irq_set_chip_and_handler(irq, &pxa_muxed_gpio_chip,
                                                 handle_edge_irq);
-                       set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
+                       irq_clear_status_flags(irq, IRQ_NOREQUEST | IRQ_NOPROBE);
                }
 
                for (irq  = gpio_to_irq(gpio_offset);
                        irq <= gpio_to_irq(pxa_last_gpio); irq++) {
                        irq_set_chip_and_handler(irq, &pxa_muxed_gpio_chip,
                                                 handle_edge_irq);
-                       set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
+                       irq_clear_status_flags(irq, IRQ_NOREQUEST | IRQ_NOPROBE);
                }
        }
 
index e847a4cf9326663530f98bf466dd37414c41d75e..67bd2f5d89e8f3d67efab99b8f3799351c263987 100644 (file)
@@ -155,7 +155,7 @@ static int sa1100_gpio_irqdomain_map(struct irq_domain *d,
 {
        irq_set_chip_and_handler(irq, &sa1100_gpio_irq_chip,
                                 handle_edge_irq);
-       set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
+       irq_set_noprobe(irq);
 
        return 0;
 }
index 18579ac65b2b04fa09df3da436aff848e98e50e9..55e47828ddfcb66f2a4ad00ae049c8576ed03698 100644 (file)
@@ -346,7 +346,7 @@ static void gsta_alloc_irq_chip(struct gsta_gpio *chip)
                        i = chip->irq_base + j;
                        irq_set_chip_and_handler(i, &ct->chip, ct->handler);
                        irq_set_chip_data(i, gc);
-                       irq_modify_status(i, IRQ_NOREQUEST | IRQ_NOPROBE, 0);
+                       irq_clear_status_flags(i, IRQ_NOREQUEST | IRQ_NOPROBE);
                }
                gc->irq_cnt = i - gc->irq_base;
        }
index 530b27f9d66f3001a8ef64d22079e8cb6a3ab418..9b14aafb576da8dc664cd75679379fe04ff4ace7 100644 (file)
@@ -507,7 +507,6 @@ static int tegra_gpio_probe(struct platform_device *pdev)
                irq_set_chip_data(irq, bank);
                irq_set_chip_and_handler(irq, &tegra_gpio_irq_chip,
                                         handle_simple_irq);
-               set_irq_flags(irq, IRQF_VALID);
        }
 
        for (i = 0; i < tegra_gpio_bank_count; i++) {
index ac53ff0a8086623510efea61258711773fcc55d6..5a492054589fa472c41f4f7ae7fc8b33b38843ce 100644 (file)
@@ -295,9 +295,7 @@ static int timbgpio_probe(struct platform_device *pdev)
                irq_set_chip_and_handler(tgpio->irq_base + i,
                        &timbgpio_irqchip, handle_simple_irq);
                irq_set_chip_data(tgpio->irq_base + i, tgpio);
-#ifdef CONFIG_ARM
-               set_irq_flags(tgpio->irq_base + i, IRQF_VALID | IRQF_PROBE);
-#endif
+               irq_clear_status_flags(tgpio->irq_base + i, IRQ_NOREQUEST | IRQ_NOPROBE);
        }
 
        irq_set_chained_handler_and_data(irq, timbgpio_irq, tgpio);
index b7e24780683ab53ea80aa187b53a7232436b0130..9312bbcb19b99dbfe412f4cb837f7df0abb62c02 100644 (file)
@@ -486,11 +486,8 @@ static int gpiochip_irq_map(struct irq_domain *d, unsigned int irq,
        /* Chips that can sleep need nested thread handlers */
        if (chip->can_sleep && !chip->irq_not_threaded)
                irq_set_nested_thread(irq, 1);
-#ifdef CONFIG_ARM
-       set_irq_flags(irq, IRQF_VALID);
-#else
        irq_set_noprobe(irq);
-#endif
+
        /*
         * No set-up of the hardware will happen if IRQ_TYPE_NONE
         * is passed as default type.
@@ -505,9 +502,6 @@ static void gpiochip_irq_unmap(struct irq_domain *d, unsigned int irq)
 {
        struct gpio_chip *chip = d->host_data;
 
-#ifdef CONFIG_ARM
-       set_irq_flags(irq, 0);
-#endif
        if (chip->can_sleep)
                irq_set_nested_thread(irq, 0);
        irq_set_chip_and_handler(irq, NULL, NULL);