Commit 77a7300a authored by Anton Vorontsov's avatar Anton Vorontsov Committed by Linus Torvalds

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: default avatarAnton Vorontsov <anton.vorontsov@linaro.org>
Acked-by: default avatarWolfram Sang <w.sang@pengutronix.de>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 10ec5e6c
...@@ -26,11 +26,6 @@ ...@@ -26,11 +26,6 @@
#include <linux/string.h> #include <linux/string.h>
#include <linux/slab.h> #include <linux/slab.h>
/* For archs that don't support NO_IRQ (such as x86), provide a dummy value */
#ifndef NO_IRQ
#define NO_IRQ 0
#endif
/** /**
* irq_of_parse_and_map - Parse and map an interrupt into linux virq space * irq_of_parse_and_map - Parse and map an interrupt into linux virq space
* @device: Device node of the device whose interrupt is to be mapped * @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) ...@@ -44,7 +39,7 @@ unsigned int irq_of_parse_and_map(struct device_node *dev, int index)
struct of_irq oirq; struct of_irq oirq;
if (of_irq_map_one(dev, index, &oirq)) if (of_irq_map_one(dev, index, &oirq))
return NO_IRQ; return 0;
return irq_create_of_mapping(oirq.controller, oirq.specifier, return irq_create_of_mapping(oirq.controller, oirq.specifier,
oirq.size); oirq.size);
...@@ -345,7 +340,7 @@ int of_irq_to_resource(struct device_node *dev, int index, struct resource *r) ...@@ -345,7 +340,7 @@ int of_irq_to_resource(struct device_node *dev, int index, struct resource *r)
/* Only dereference the resource if both the /* Only dereference the resource if both the
* resource and the irq are valid. */ * resource and the irq are valid. */
if (r && irq != NO_IRQ) { if (r && irq) {
r->start = r->end = irq; r->start = r->end = irq;
r->flags = IORESOURCE_IRQ; r->flags = IORESOURCE_IRQ;
r->name = dev->full_name; r->name = dev->full_name;
...@@ -363,7 +358,7 @@ int of_irq_count(struct device_node *dev) ...@@ -363,7 +358,7 @@ int of_irq_count(struct device_node *dev)
{ {
int nr = 0; int nr = 0;
while (of_irq_to_resource(dev, nr, NULL) != NO_IRQ) while (of_irq_to_resource(dev, nr, NULL))
nr++; nr++;
return nr; return nr;
...@@ -383,7 +378,7 @@ int of_irq_to_resource_table(struct device_node *dev, struct resource *res, ...@@ -383,7 +378,7 @@ int of_irq_to_resource_table(struct device_node *dev, struct resource *res,
int i; int i;
for (i = 0; i < nr_irqs; i++, res++) for (i = 0; i < nr_irqs; i++, res++)
if (of_irq_to_resource(dev, i, res) == NO_IRQ) if (!of_irq_to_resource(dev, i, res))
break; break;
return i; return i;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment