diff options
| author | Steve French <sfrench@us.ibm.com> | 2011-12-16 01:39:20 -0500 |
|---|---|---|
| committer | Steve French <sfrench@us.ibm.com> | 2011-12-16 01:39:20 -0500 |
| commit | aaf015890754d58dcb71a4aa44ed246bb082bcf6 (patch) | |
| tree | 17b51ff707fd1b3efec3a3ab872f0d7a7416aca5 /drivers/of | |
| parent | 9c32c63bb70b2fafc3b18bee29959c3bf245ceba (diff) | |
| parent | 8def5f51b012efb00e77ba2d04696cc0aadd0609 (diff) | |
Merge branch 'master' of git+ssh://git.samba.org/data/git/sfrench/cifs-2.6
Diffstat (limited to 'drivers/of')
| -rw-r--r-- | drivers/of/irq.c | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/drivers/of/irq.c b/drivers/of/irq.c index 6d3dd3988d0f..0f0cfa3bca30 100644 --- a/drivers/of/irq.c +++ b/drivers/of/irq.c | |||
| @@ -26,11 +26,6 @@ | |||
| 26 | #include <linux/string.h> | 26 | #include <linux/string.h> |
| 27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
| 28 | 28 | ||
| 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 | |||
| 34 | /** | 29 | /** |
| 35 | * irq_of_parse_and_map - Parse and map an interrupt into linux virq space | 30 | * irq_of_parse_and_map - Parse and map an interrupt into linux virq space |
| 36 | * @device: Device node of the device whose interrupt is to be mapped | 31 | * @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 | struct of_irq oirq; | 39 | struct of_irq oirq; |
| 45 | 40 | ||
| 46 | if (of_irq_map_one(dev, index, &oirq)) | 41 | if (of_irq_map_one(dev, index, &oirq)) |
| 47 | return NO_IRQ; | 42 | return 0; |
| 48 | 43 | ||
| 49 | return irq_create_of_mapping(oirq.controller, oirq.specifier, | 44 | return irq_create_of_mapping(oirq.controller, oirq.specifier, |
| 50 | oirq.size); | 45 | oirq.size); |
| @@ -60,27 +55,27 @@ EXPORT_SYMBOL_GPL(irq_of_parse_and_map); | |||
| 60 | */ | 55 | */ |
| 61 | struct device_node *of_irq_find_parent(struct device_node *child) | 56 | struct device_node *of_irq_find_parent(struct device_node *child) |
| 62 | { | 57 | { |
| 63 | struct device_node *p, *c = child; | 58 | struct device_node *p; |
| 64 | const __be32 *parp; | 59 | const __be32 *parp; |
| 65 | 60 | ||
| 66 | if (!of_node_get(c)) | 61 | if (!of_node_get(child)) |
| 67 | return NULL; | 62 | return NULL; |
| 68 | 63 | ||
| 69 | do { | 64 | do { |
| 70 | parp = of_get_property(c, "interrupt-parent", NULL); | 65 | parp = of_get_property(child, "interrupt-parent", NULL); |
| 71 | if (parp == NULL) | 66 | if (parp == NULL) |
| 72 | p = of_get_parent(c); | 67 | p = of_get_parent(child); |
| 73 | else { | 68 | else { |
| 74 | if (of_irq_workarounds & OF_IMAP_NO_PHANDLE) | 69 | if (of_irq_workarounds & OF_IMAP_NO_PHANDLE) |
| 75 | p = of_node_get(of_irq_dflt_pic); | 70 | p = of_node_get(of_irq_dflt_pic); |
| 76 | else | 71 | else |
| 77 | p = of_find_node_by_phandle(be32_to_cpup(parp)); | 72 | p = of_find_node_by_phandle(be32_to_cpup(parp)); |
| 78 | } | 73 | } |
| 79 | of_node_put(c); | 74 | of_node_put(child); |
| 80 | c = p; | 75 | child = p; |
| 81 | } while (p && of_get_property(p, "#interrupt-cells", NULL) == NULL); | 76 | } while (p && of_get_property(p, "#interrupt-cells", NULL) == NULL); |
| 82 | 77 | ||
| 83 | return (p == child) ? NULL : p; | 78 | return p; |
| 84 | } | 79 | } |
| 85 | 80 | ||
| 86 | /** | 81 | /** |
| @@ -345,7 +340,7 @@ int of_irq_to_resource(struct device_node *dev, int index, struct resource *r) | |||
| 345 | 340 | ||
| 346 | /* Only dereference the resource if both the | 341 | /* Only dereference the resource if both the |
| 347 | * resource and the irq are valid. */ | 342 | * resource and the irq are valid. */ |
| 348 | if (r && irq != NO_IRQ) { | 343 | if (r && irq) { |
| 349 | r->start = r->end = irq; | 344 | r->start = r->end = irq; |
| 350 | r->flags = IORESOURCE_IRQ; | 345 | r->flags = IORESOURCE_IRQ; |
| 351 | r->name = dev->full_name; | 346 | r->name = dev->full_name; |
| @@ -363,7 +358,7 @@ int of_irq_count(struct device_node *dev) | |||
| 363 | { | 358 | { |
| 364 | int nr = 0; | 359 | int nr = 0; |
| 365 | 360 | ||
| 366 | while (of_irq_to_resource(dev, nr, NULL) != NO_IRQ) | 361 | while (of_irq_to_resource(dev, nr, NULL)) |
| 367 | nr++; | 362 | nr++; |
| 368 | 363 | ||
| 369 | return nr; | 364 | return nr; |
| @@ -383,7 +378,7 @@ int of_irq_to_resource_table(struct device_node *dev, struct resource *res, | |||
| 383 | int i; | 378 | int i; |
| 384 | 379 | ||
| 385 | for (i = 0; i < nr_irqs; i++, res++) | 380 | 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)) |
| 387 | break; | 382 | break; |
| 388 | 383 | ||
| 389 | return i; | 384 | return i; |
| @@ -424,6 +419,8 @@ void __init of_irq_init(const struct of_device_id *matches) | |||
| 424 | 419 | ||
| 425 | desc->dev = np; | 420 | desc->dev = np; |
| 426 | desc->interrupt_parent = of_irq_find_parent(np); | 421 | desc->interrupt_parent = of_irq_find_parent(np); |
| 422 | if (desc->interrupt_parent == np) | ||
| 423 | desc->interrupt_parent = NULL; | ||
| 427 | list_add_tail(&desc->list, &intc_desc_list); | 424 | list_add_tail(&desc->list, &intc_desc_list); |
| 428 | } | 425 | } |
| 429 | 426 | ||
