Skip to content

Commit 77a7300

Browse files
Anton Vorontsovtorvalds
authored andcommitted
of/irq: Get rid of NO_IRQ usage
PPC32/64 defines NO_IRQ to zero, so no problems expected. ARM defines NO_IRQ to -1, but OF code relies on IRQ domains support, which returns correct ('0') value in 'no irq' case. So everything should be fine. Other arches might break if some of their OF drivers rely on NO_IRQ being not 0. If so, the drivers must be fixed, finally. [ Rob Herring points out that microblaze should be fixed, and has posted a patch for testing for that. - Linus ] Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org> Acked-by: Wolfram Sang <w.sang@pengutronix.de> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 10ec5e6 commit 77a7300

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

drivers/of/irq.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@
2626
#include <linux/string.h>
2727
#include <linux/slab.h>
2828

29-
/* For archs that don't support NO_IRQ (such as x86), provide a dummy value */
30-
#ifndef NO_IRQ
31-
#define NO_IRQ 0
32-
#endif
33-
3429
/**
3530
* irq_of_parse_and_map - Parse and map an interrupt into linux virq space
3631
* @device: Device node of the device whose interrupt is to be mapped
@@ -44,7 +39,7 @@ unsigned int irq_of_parse_and_map(struct device_node *dev, int index)
4439
struct of_irq oirq;
4540

4641
if (of_irq_map_one(dev, index, &oirq))
47-
return NO_IRQ;
42+
return 0;
4843

4944
return irq_create_of_mapping(oirq.controller, oirq.specifier,
5045
oirq.size);
@@ -345,7 +340,7 @@ int of_irq_to_resource(struct device_node *dev, int index, struct resource *r)
345340

346341
/* Only dereference the resource if both the
347342
* resource and the irq are valid. */
348-
if (r && irq != NO_IRQ) {
343+
if (r && irq) {
349344
r->start = r->end = irq;
350345
r->flags = IORESOURCE_IRQ;
351346
r->name = dev->full_name;
@@ -363,7 +358,7 @@ int of_irq_count(struct device_node *dev)
363358
{
364359
int nr = 0;
365360

366-
while (of_irq_to_resource(dev, nr, NULL) != NO_IRQ)
361+
while (of_irq_to_resource(dev, nr, NULL))
367362
nr++;
368363

369364
return nr;
@@ -383,7 +378,7 @@ int of_irq_to_resource_table(struct device_node *dev, struct resource *res,
383378
int i;
384379

385380
for (i = 0; i < nr_irqs; i++, res++)
386-
if (of_irq_to_resource(dev, i, res) == NO_IRQ)
381+
if (!of_irq_to_resource(dev, i, res))
387382
break;
388383

389384
return i;

0 commit comments

Comments
 (0)