]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/powerpc/kernel/irq.c
[POWERPC] Whitespace cleanup in arch/powerpc
[linux-2.6-omap-h63xx.git] / arch / powerpc / kernel / irq.c
index 9ed4931af1641253cce9dfce6c52fd6deb91c230..dfad0e469eec898887a7dbbbb476ee28c95b39ec 100644 (file)
@@ -7,7 +7,6 @@
  *    Copyright (C) 1996-2001 Cort Dougan
  *  Adapted for Power Macintosh by Paul Mackerras
  *    Copyright (C) 1996 Paul Mackerras (paulus@cs.anu.edu.au)
- *  Amiga/APUS changes by Jesper Skov (jskov@cygnus.co.uk).
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -173,7 +172,7 @@ void local_irq_restore(unsigned long en)
                lv1_get_version_info(&tmp);
        }
 
-       hard_irq_enable();
+       __hard_irq_enable();
 }
 #endif /* CONFIG_PPC64 */
 
@@ -273,7 +272,7 @@ void do_IRQ(struct pt_regs *regs)
        struct thread_info *curtp, *irqtp;
 #endif
 
-        irq_enter();
+       irq_enter();
 
 #ifdef CONFIG_DEBUG_STACKOVERFLOW
        /* Debugging check for stack overflow: is there less than 2KB free? */
@@ -322,7 +321,7 @@ void do_IRQ(struct pt_regs *regs)
                /* That's not SMP safe ... but who cares ? */
                ppc_spurious_interrupts++;
 
-        irq_exit();
+       irq_exit();
        set_irq_regs(old_regs);
 
 #ifdef CONFIG_PPC_ISERIES
@@ -337,7 +336,8 @@ void do_IRQ(struct pt_regs *regs)
 
 void __init init_IRQ(void)
 {
-       ppc_md.init_IRQ();
+       if (ppc_md.init_IRQ)
+               ppc_md.init_IRQ();
 #ifdef CONFIG_PPC64
        irq_ctx_init();
 #endif
@@ -412,10 +412,16 @@ struct irq_map_entry irq_map[NR_IRQS];
 static unsigned int irq_virq_count = NR_IRQS;
 static struct irq_host *irq_default_host;
 
-struct irq_host *irq_alloc_host(unsigned int revmap_type,
-                               unsigned int revmap_arg,
-                               struct irq_host_ops *ops,
-                               irq_hw_number_t inval_irq)
+irq_hw_number_t virq_to_hw(unsigned int virq)
+{
+       return irq_map[virq].hwirq;
+}
+EXPORT_SYMBOL_GPL(virq_to_hw);
+
+__init_refok struct irq_host *irq_alloc_host(unsigned int revmap_type,
+                                               unsigned int revmap_arg,
+                                               struct irq_host_ops *ops,
+                                               irq_hw_number_t inval_irq)
 {
        struct irq_host *host;
        unsigned int size = sizeof(struct irq_host);
@@ -489,7 +495,7 @@ struct irq_host *irq_alloc_host(unsigned int revmap_type,
        case IRQ_HOST_MAP_LINEAR:
                rmap = (unsigned int *)(host + 1);
                for (i = 0; i < revmap_arg; i++)
-                       rmap[i] = IRQ_NONE;
+                       rmap[i] = NO_IRQ;
                host->revmap_data.linear.size = revmap_arg;
                smp_wmb();
                host->revmap_data.linear.revmap = rmap;
@@ -591,6 +597,49 @@ static void irq_radix_rdunlock(unsigned long flags)
        local_irq_restore(flags);
 }
 
+static int irq_setup_virq(struct irq_host *host, unsigned int virq,
+                           irq_hw_number_t hwirq)
+{
+       /* Clear IRQ_NOREQUEST flag */
+       get_irq_desc(virq)->status &= ~IRQ_NOREQUEST;
+
+       /* map it */
+       smp_wmb();
+       irq_map[virq].hwirq = hwirq;
+       smp_mb();
+
+       if (host->ops->map(host, virq, hwirq)) {
+               pr_debug("irq: -> mapping failed, freeing\n");
+               irq_free_virt(virq, 1);
+               return -1;
+       }
+
+       return 0;
+}
+
+unsigned int irq_create_direct_mapping(struct irq_host *host)
+{
+       unsigned int virq;
+
+       if (host == NULL)
+               host = irq_default_host;
+
+       BUG_ON(host == NULL);
+       WARN_ON(host->revmap_type != IRQ_HOST_MAP_NOMAP);
+
+       virq = irq_alloc_virt(host, 1, 0);
+       if (virq == NO_IRQ) {
+               pr_debug("irq: create_direct virq allocation failed\n");
+               return NO_IRQ;
+       }
+
+       pr_debug("irq: create_direct obtained virq %d\n", virq);
+
+       if (irq_setup_virq(host, virq, virq))
+               return NO_IRQ;
+
+       return virq;
+}
 
 unsigned int irq_create_mapping(struct irq_host *host,
                                irq_hw_number_t hwirq)
@@ -614,7 +663,7 @@ unsigned int irq_create_mapping(struct irq_host *host,
         * host->ops->map() to update the flags
         */
        virq = irq_find_mapping(host, hwirq);
-       if (virq != IRQ_NONE) {
+       if (virq != NO_IRQ) {
                if (host->ops->remap)
                        host->ops->remap(host, virq, hwirq);
                pr_debug("irq: -> existing mapping on virq %d\n", virq);
@@ -639,18 +688,9 @@ unsigned int irq_create_mapping(struct irq_host *host,
        }
        pr_debug("irq: -> obtained virq %d\n", virq);
 
-       /* Clear IRQ_NOREQUEST flag */
-       get_irq_desc(virq)->status &= ~IRQ_NOREQUEST;
-
-       /* map it */
-       smp_wmb();
-       irq_map[virq].hwirq = hwirq;
-       smp_mb();
-       if (host->ops->map(host, virq, hwirq)) {
-               pr_debug("irq: -> mapping failed, freeing\n");
-               irq_free_virt(virq, 1);
+       if (irq_setup_virq(host, virq, hwirq))
                return NO_IRQ;
-       }
+
        return virq;
 }
 EXPORT_SYMBOL_GPL(irq_create_mapping);
@@ -741,7 +781,7 @@ void irq_dispose_mapping(unsigned int virq)
        switch(host->revmap_type) {
        case IRQ_HOST_MAP_LINEAR:
                if (hwirq < host->revmap_data.linear.size)
-                       host->revmap_data.linear.revmap[hwirq] = IRQ_NONE;
+                       host->revmap_data.linear.revmap[hwirq] = NO_IRQ;
                break;
        case IRQ_HOST_MAP_TREE:
                /* Check if radix tree allocated yet */