powerpc: Use new irq allocator
authorThomas Gleixner <tglx@linutronix.de>
Fri, 21 Jan 2011 06:12:30 +0000 (06:12 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Wed, 2 Mar 2011 05:50:24 +0000 (16:50 +1100)
Use the new functions and free the descriptor when the virq is
destroyed.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/kernel/irq.c

index 0531ccda80053322e6dfbaeadbc0a3cb38e0e3d9..8a958ca26ac2e59422a260435c046415f2bafb2b 100644 (file)
@@ -678,16 +678,15 @@ void irq_set_virq_count(unsigned int count)
 static int irq_setup_virq(struct irq_host *host, unsigned int virq,
                            irq_hw_number_t hwirq)
 {
-       struct irq_desc *desc;
+       int res;
 
-       desc = irq_to_desc_alloc_node(virq, 0);
-       if (!desc) {
+       res = irq_alloc_desc_at(virq, 0);
+       if (res != virq) {
                pr_debug("irq: -> allocating desc failed\n");
                goto error;
        }
 
-       /* Clear IRQ_NOREQUEST flag */
-       desc->status &= ~IRQ_NOREQUEST;
+       irq_clear_status_flags(virq, IRQ_NOREQUEST);
 
        /* map it */
        smp_wmb();
@@ -696,11 +695,13 @@ static int irq_setup_virq(struct irq_host *host, unsigned int virq,
 
        if (host->ops->map(host, virq, hwirq)) {
                pr_debug("irq: -> mapping failed, freeing\n");
-               goto error;
+               goto errdesc;
        }
 
        return 0;
 
+errdesc:
+       irq_free_descs(virq, 1);
 error:
        irq_free_virt(virq, 1);
        return -1;
@@ -879,9 +880,9 @@ void irq_dispose_mapping(unsigned int virq)
        smp_mb();
        irq_map[virq].hwirq = host->inval_irq;
 
-       /* Set some flags */
-       irq_to_desc(virq)->status |= IRQ_NOREQUEST;
+       irq_set_status_flags(virq, IRQ_NOREQUEST);
 
+       irq_free_descs(virq, 1);
        /* Free it */
        irq_free_virt(virq, 1);
 }