Skip to content

Commit 23393d4

Browse files
robherringlinusw
authored andcommitted
gpio: kill off set_irq_flags usage
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 <[email protected]> Cc: Michael Hennerich <[email protected]> Acked-by: Linus Walleij <[email protected]> Cc: Alexandre Courbot <[email protected]> Cc: Ray Jui <[email protected]> Cc: Stephen Warren <[email protected]> Cc: Thierry Reding <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Signed-off-by: Linus Walleij <[email protected]>
1 parent d705073 commit 23393d4

14 files changed

+10
-57
lines changed

drivers/gpio/gpio-adp5588.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -305,15 +305,7 @@ static int adp5588_irq_setup(struct adp5588_gpio *dev)
305305
irq_set_chip_and_handler(irq, &adp5588_irq_chip,
306306
handle_level_irq);
307307
irq_set_nested_thread(irq, 1);
308-
#ifdef CONFIG_ARM
309-
/*
310-
* ARM needs us to explicitly flag the IRQ as VALID,
311-
* once we do so, it will also set the noprobe.
312-
*/
313-
set_irq_flags(irq, IRQF_VALID);
314-
#else
315-
irq_set_noprobe(irq);
316-
#endif
308+
irq_modify_status(irq, IRQ_NOREQUEST, IRQ_NOPROBE);
317309
}
318310

319311
ret = request_threaded_irq(client->irq,

drivers/gpio/gpio-bcm-kona.c

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -525,11 +525,7 @@ static int bcm_kona_gpio_irq_map(struct irq_domain *d, unsigned int irq,
525525
return ret;
526526
irq_set_lockdep_class(irq, &gpio_lock_class);
527527
irq_set_chip_and_handler(irq, &bcm_gpio_irq_chip, handle_simple_irq);
528-
#ifdef CONFIG_ARM
529-
set_irq_flags(irq, IRQF_VALID);
530-
#else
531528
irq_set_noprobe(irq);
532-
#endif
533529

534530
return 0;
535531
}
@@ -644,17 +640,6 @@ static int bcm_kona_gpio_probe(struct platform_device *pdev)
644640
dev_err(dev, "Couldn't add GPIO chip -- %d\n", ret);
645641
goto err_irq_domain;
646642
}
647-
for (i = 0; i < chip->ngpio; i++) {
648-
int irq = bcm_kona_gpio_to_irq(chip, i);
649-
irq_set_lockdep_class(irq, &gpio_lock_class);
650-
irq_set_chip_and_handler(irq, &bcm_gpio_irq_chip,
651-
handle_simple_irq);
652-
#ifdef CONFIG_ARM
653-
set_irq_flags(irq, IRQF_VALID);
654-
#else
655-
irq_set_noprobe(irq);
656-
#endif
657-
}
658643
for (i = 0; i < kona_gpio->num_bank; i++) {
659644
bank = &kona_gpio->banks[i];
660645
irq_set_chained_handler_and_data(bank->irq,

drivers/gpio/gpio-davinci.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,6 @@ davinci_gpio_irq_map(struct irq_domain *d, unsigned int irq,
423423
irq_set_irq_type(irq, IRQ_TYPE_NONE);
424424
irq_set_chip_data(irq, (__force void *)g);
425425
irq_set_handler_data(irq, (void *)__gpio_mask(hw));
426-
set_irq_flags(irq, IRQF_VALID);
427426

428427
return 0;
429428
}

drivers/gpio/gpio-em.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,6 @@ static int em_gio_irq_domain_map(struct irq_domain *h, unsigned int irq,
261261

262262
irq_set_chip_data(irq, h->host_data);
263263
irq_set_chip_and_handler(irq, &p->irq_chip, handle_level_irq);
264-
set_irq_flags(irq, IRQF_VALID); /* kill me now */
265264
return 0;
266265
}
267266

drivers/gpio/gpio-ep93xx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ static void ep93xx_gpio_init_irq(void)
236236
gpio_irq <= gpio_to_irq(EP93XX_GPIO_LINE_MAX_IRQ); ++gpio_irq) {
237237
irq_set_chip_and_handler(gpio_irq, &ep93xx_gpio_irq_chip,
238238
handle_level_irq);
239-
set_irq_flags(gpio_irq, IRQF_VALID);
239+
irq_clear_status_flags(gpio_irq, IRQ_NOREQUEST);
240240
}
241241

242242
irq_set_chained_handler(IRQ_EP93XX_GPIO_AB,

drivers/gpio/gpio-grgpio.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -281,12 +281,7 @@ static int grgpio_irq_map(struct irq_domain *d, unsigned int irq,
281281
irq_set_chip_data(irq, priv);
282282
irq_set_chip_and_handler(irq, &grgpio_irq_chip,
283283
handle_simple_irq);
284-
irq_clear_status_flags(irq, IRQ_NOREQUEST);
285-
#ifdef CONFIG_ARM
286-
set_irq_flags(irq, IRQF_VALID);
287-
#else
288284
irq_set_noprobe(irq);
289-
#endif
290285

291286
return ret;
292287
}
@@ -301,9 +296,6 @@ static void grgpio_irq_unmap(struct irq_domain *d, unsigned int irq)
301296
int ngpio = priv->bgc.gc.ngpio;
302297
int i;
303298

304-
#ifdef CONFIG_ARM
305-
set_irq_flags(irq, 0);
306-
#endif
307299
irq_set_chip_and_handler(irq, NULL, NULL);
308300
irq_set_chip_data(irq, NULL);
309301

drivers/gpio/gpio-mcp23s08.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -507,11 +507,7 @@ static int mcp23s08_irq_setup(struct mcp23s08 *mcp)
507507
irq_set_chip_data(irq, mcp);
508508
irq_set_chip(irq, &mcp23s08_irq_chip);
509509
irq_set_nested_thread(irq, true);
510-
#ifdef CONFIG_ARM
511-
set_irq_flags(irq, IRQF_VALID);
512-
#else
513510
irq_set_noprobe(irq);
514-
#endif
515511
}
516512
return 0;
517513
}

drivers/gpio/gpio-msm-v2.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,6 @@ static int msm_gpio_irq_domain_map(struct irq_domain *d, unsigned int irq,
355355
irq_set_lockdep_class(irq, &msm_gpio_lock_class);
356356
irq_set_chip_and_handler(irq, &msm_gpio_irq_chip,
357357
handle_level_irq);
358-
set_irq_flags(irq, IRQF_VALID);
359358

360359
return 0;
361360
}

drivers/gpio/gpio-pxa.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ static int pxa_irq_domain_map(struct irq_domain *d, unsigned int irq,
524524
{
525525
irq_set_chip_and_handler(irq, &pxa_muxed_gpio_chip,
526526
handle_edge_irq);
527-
set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
527+
irq_set_noprobe(irq);
528528
return 0;
529529
}
530530

@@ -643,20 +643,20 @@ static int pxa_gpio_probe(struct platform_device *pdev)
643643
irq = gpio_to_irq(0);
644644
irq_set_chip_and_handler(irq, &pxa_muxed_gpio_chip,
645645
handle_edge_irq);
646-
set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
646+
irq_clear_status_flags(irq, IRQ_NOREQUEST | IRQ_NOPROBE);
647647
}
648648
if (irq1 > 0) {
649649
irq = gpio_to_irq(1);
650650
irq_set_chip_and_handler(irq, &pxa_muxed_gpio_chip,
651651
handle_edge_irq);
652-
set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
652+
irq_clear_status_flags(irq, IRQ_NOREQUEST | IRQ_NOPROBE);
653653
}
654654

655655
for (irq = gpio_to_irq(gpio_offset);
656656
irq <= gpio_to_irq(pxa_last_gpio); irq++) {
657657
irq_set_chip_and_handler(irq, &pxa_muxed_gpio_chip,
658658
handle_edge_irq);
659-
set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
659+
irq_clear_status_flags(irq, IRQ_NOREQUEST | IRQ_NOPROBE);
660660
}
661661
}
662662

drivers/gpio/gpio-sa1100.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ static int sa1100_gpio_irqdomain_map(struct irq_domain *d,
155155
{
156156
irq_set_chip_and_handler(irq, &sa1100_gpio_irq_chip,
157157
handle_edge_irq);
158-
set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
158+
irq_set_noprobe(irq);
159159

160160
return 0;
161161
}

drivers/gpio/gpio-sta2x11.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ static void gsta_alloc_irq_chip(struct gsta_gpio *chip)
346346
i = chip->irq_base + j;
347347
irq_set_chip_and_handler(i, &ct->chip, ct->handler);
348348
irq_set_chip_data(i, gc);
349-
irq_modify_status(i, IRQ_NOREQUEST | IRQ_NOPROBE, 0);
349+
irq_clear_status_flags(i, IRQ_NOREQUEST | IRQ_NOPROBE);
350350
}
351351
gc->irq_cnt = i - gc->irq_base;
352352
}

drivers/gpio/gpio-tegra.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,6 @@ static int tegra_gpio_probe(struct platform_device *pdev)
507507
irq_set_chip_data(irq, bank);
508508
irq_set_chip_and_handler(irq, &tegra_gpio_irq_chip,
509509
handle_simple_irq);
510-
set_irq_flags(irq, IRQF_VALID);
511510
}
512511

513512
for (i = 0; i < tegra_gpio_bank_count; i++) {

drivers/gpio/gpio-timberdale.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,9 +295,7 @@ static int timbgpio_probe(struct platform_device *pdev)
295295
irq_set_chip_and_handler(tgpio->irq_base + i,
296296
&timbgpio_irqchip, handle_simple_irq);
297297
irq_set_chip_data(tgpio->irq_base + i, tgpio);
298-
#ifdef CONFIG_ARM
299-
set_irq_flags(tgpio->irq_base + i, IRQF_VALID | IRQF_PROBE);
300-
#endif
298+
irq_clear_status_flags(tgpio->irq_base + i, IRQ_NOREQUEST | IRQ_NOPROBE);
301299
}
302300

303301
irq_set_chained_handler_and_data(irq, timbgpio_irq, tgpio);

drivers/gpio/gpiolib.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -486,11 +486,8 @@ static int gpiochip_irq_map(struct irq_domain *d, unsigned int irq,
486486
/* Chips that can sleep need nested thread handlers */
487487
if (chip->can_sleep && !chip->irq_not_threaded)
488488
irq_set_nested_thread(irq, 1);
489-
#ifdef CONFIG_ARM
490-
set_irq_flags(irq, IRQF_VALID);
491-
#else
492489
irq_set_noprobe(irq);
493-
#endif
490+
494491
/*
495492
* No set-up of the hardware will happen if IRQ_TYPE_NONE
496493
* is passed as default type.
@@ -505,9 +502,6 @@ static void gpiochip_irq_unmap(struct irq_domain *d, unsigned int irq)
505502
{
506503
struct gpio_chip *chip = d->host_data;
507504

508-
#ifdef CONFIG_ARM
509-
set_irq_flags(irq, 0);
510-
#endif
511505
if (chip->can_sleep)
512506
irq_set_nested_thread(irq, 0);
513507
irq_set_chip_and_handler(irq, NULL, NULL);

0 commit comments

Comments
 (0)