diff options
author | Andres Salomon <dilinger@queued.net> | 2010-10-10 23:35:05 -0400 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2010-10-12 23:58:27 -0400 |
commit | 52f6537cb2f0b461a9ce3457c01a6cfa2ae0bb22 (patch) | |
tree | db720ce58637b3c70277f9b0fbe5082fcf6f9b94 /drivers/of/irq.c | |
parent | e2f2a93b6384cfe0face0be595bfbda1475d864b (diff) |
of/irq: remove references to NO_IRQ in drivers/of/platform.c
Instead of referencing NO_IRQ in platform.c, define some helper functions
in irq.c to call instead from platform.c. Keep NO_IRQ usage local to
irq.c, and define NO_IRQ if not defined in headers.
Signed-off-by: Andres Salomon <dilinger@queued.net>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'drivers/of/irq.c')
-rw-r--r-- | drivers/of/irq.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/drivers/of/irq.c b/drivers/of/irq.c index 6e595e5a3977..75b0d3cb7676 100644 --- a/drivers/of/irq.c +++ b/drivers/of/irq.c | |||
@@ -24,6 +24,11 @@ | |||
24 | #include <linux/of_irq.h> | 24 | #include <linux/of_irq.h> |
25 | #include <linux/string.h> | 25 | #include <linux/string.h> |
26 | 26 | ||
27 | /* For archs that don't support NO_IRQ (such as x86), provide a dummy value */ | ||
28 | #ifndef NO_IRQ | ||
29 | #define NO_IRQ 0 | ||
30 | #endif | ||
31 | |||
27 | /** | 32 | /** |
28 | * irq_of_parse_and_map - Parse and map an interrupt into linux virq space | 33 | * irq_of_parse_and_map - Parse and map an interrupt into linux virq space |
29 | * @device: Device node of the device whose interrupt is to be mapped | 34 | * @device: Device node of the device whose interrupt is to be mapped |
@@ -347,3 +352,37 @@ int of_irq_to_resource(struct device_node *dev, int index, struct resource *r) | |||
347 | return irq; | 352 | return irq; |
348 | } | 353 | } |
349 | EXPORT_SYMBOL_GPL(of_irq_to_resource); | 354 | EXPORT_SYMBOL_GPL(of_irq_to_resource); |
355 | |||
356 | /** | ||
357 | * of_irq_count - Count the number of IRQs a node uses | ||
358 | * @dev: pointer to device tree node | ||
359 | */ | ||
360 | int of_irq_count(struct device_node *dev) | ||
361 | { | ||
362 | int nr = 0; | ||
363 | |||
364 | while (of_irq_to_resource(dev, nr, NULL) != NO_IRQ) | ||
365 | nr++; | ||
366 | |||
367 | return nr; | ||
368 | } | ||
369 | |||
370 | /** | ||
371 | * of_irq_to_resource_table - Fill in resource table with node's IRQ info | ||
372 | * @dev: pointer to device tree node | ||
373 | * @res: array of resources to fill in | ||
374 | * @nr_irqs: the number of IRQs (and upper bound for num of @res elements) | ||
375 | * | ||
376 | * Returns the size of the filled in table (up to @nr_irqs). | ||
377 | */ | ||
378 | int of_irq_to_resource_table(struct device_node *dev, struct resource *res, | ||
379 | int nr_irqs) | ||
380 | { | ||
381 | int i; | ||
382 | |||
383 | for (i = 0; i < nr_irqs; i++, res++) | ||
384 | if (of_irq_to_resource(dev, i, res) == NO_IRQ) | ||
385 | break; | ||
386 | |||
387 | return i; | ||
388 | } | ||