include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit...
[safe/jmp/linux-2.6] / arch / mips / sibyte / bcm1480 / irq.c
index a35818e..7a8b0a8 100644 (file)
@@ -19,9 +19,9 @@
 #include <linux/init.h>
 #include <linux/linkage.h>
 #include <linux/interrupt.h>
+#include <linux/smp.h>
 #include <linux/spinlock.h>
 #include <linux/mm.h>
-#include <linux/slab.h>
 #include <linux/kernel_stat.h>
 
 #include <asm/errno.h>
@@ -50,7 +50,7 @@ static void enable_bcm1480_irq(unsigned int irq);
 static void disable_bcm1480_irq(unsigned int irq);
 static void ack_bcm1480_irq(unsigned int irq);
 #ifdef CONFIG_SMP
-static void bcm1480_set_affinity(unsigned int irq, cpumask_t mask);
+static int bcm1480_set_affinity(unsigned int irq, const struct cpumask *mask);
 #endif
 
 #ifdef CONFIG_PCI
@@ -72,14 +72,14 @@ static struct irq_chip bcm1480_irq_type = {
 /* Store the CPU id (not the logical number) */
 int bcm1480_irq_owner[BCM1480_NR_IRQS];
 
-DEFINE_SPINLOCK(bcm1480_imr_lock);
+static DEFINE_RAW_SPINLOCK(bcm1480_imr_lock);
 
 void bcm1480_mask_irq(int cpu, int irq)
 {
        unsigned long flags, hl_spacing;
        u64 cur_ints;
 
-       spin_lock_irqsave(&bcm1480_imr_lock, flags);
+       raw_spin_lock_irqsave(&bcm1480_imr_lock, flags);
        hl_spacing = 0;
        if ((irq >= BCM1480_NR_IRQS_HALF) && (irq <= BCM1480_NR_IRQS)) {
                hl_spacing = BCM1480_IMR_HL_SPACING;
@@ -88,7 +88,7 @@ void bcm1480_mask_irq(int cpu, int irq)
        cur_ints = ____raw_readq(IOADDR(A_BCM1480_IMR_MAPPER(cpu) + R_BCM1480_IMR_INTERRUPT_MASK_H + hl_spacing));
        cur_ints |= (((u64) 1) << irq);
        ____raw_writeq(cur_ints, IOADDR(A_BCM1480_IMR_MAPPER(cpu) + R_BCM1480_IMR_INTERRUPT_MASK_H + hl_spacing));
-       spin_unlock_irqrestore(&bcm1480_imr_lock, flags);
+       raw_spin_unlock_irqrestore(&bcm1480_imr_lock, flags);
 }
 
 void bcm1480_unmask_irq(int cpu, int irq)
@@ -96,7 +96,7 @@ void bcm1480_unmask_irq(int cpu, int irq)
        unsigned long flags, hl_spacing;
        u64 cur_ints;
 
-       spin_lock_irqsave(&bcm1480_imr_lock, flags);
+       raw_spin_lock_irqsave(&bcm1480_imr_lock, flags);
        hl_spacing = 0;
        if ((irq >= BCM1480_NR_IRQS_HALF) && (irq <= BCM1480_NR_IRQS)) {
                hl_spacing = BCM1480_IMR_HL_SPACING;
@@ -105,30 +105,24 @@ void bcm1480_unmask_irq(int cpu, int irq)
        cur_ints = ____raw_readq(IOADDR(A_BCM1480_IMR_MAPPER(cpu) + R_BCM1480_IMR_INTERRUPT_MASK_H + hl_spacing));
        cur_ints &= ~(((u64) 1) << irq);
        ____raw_writeq(cur_ints, IOADDR(A_BCM1480_IMR_MAPPER(cpu) + R_BCM1480_IMR_INTERRUPT_MASK_H + hl_spacing));
-       spin_unlock_irqrestore(&bcm1480_imr_lock, flags);
+       raw_spin_unlock_irqrestore(&bcm1480_imr_lock, flags);
 }
 
 #ifdef CONFIG_SMP
-static void bcm1480_set_affinity(unsigned int irq, cpumask_t mask)
+static int bcm1480_set_affinity(unsigned int irq, const struct cpumask *mask)
 {
        int i = 0, old_cpu, cpu, int_on, k;
        u64 cur_ints;
-       struct irq_desc *desc = irq_desc + irq;
        unsigned long flags;
        unsigned int irq_dirty;
 
-       if (cpus_weight(mask) != 1) {
-               printk("attempted to set irq affinity for irq %d to multiple CPUs\n", irq);
-               return;
-       }
-       i = first_cpu(mask);
+       i = cpumask_first(mask);
 
        /* Convert logical CPU to physical CPU */
        cpu = cpu_logical_map(i);
 
        /* Protect against other affinity changers and IMR manipulation */
-       spin_lock_irqsave(&desc->lock, flags);
-       spin_lock(&bcm1480_imr_lock);
+       raw_spin_lock_irqsave(&bcm1480_imr_lock, flags);
 
        /* Swizzle each CPU's IMR (but leave the IP selection alone) */
        old_cpu = bcm1480_irq_owner[irq];
@@ -153,8 +147,9 @@ static void bcm1480_set_affinity(unsigned int irq, cpumask_t mask)
                        ____raw_writeq(cur_ints, IOADDR(A_BCM1480_IMR_MAPPER(cpu) + R_BCM1480_IMR_INTERRUPT_MASK_H + (k*BCM1480_IMR_HL_SPACING)));
                }
        }
-       spin_unlock(&bcm1480_imr_lock);
-       spin_unlock_irqrestore(&desc->lock, flags);
+       raw_spin_unlock_irqrestore(&bcm1480_imr_lock, flags);
+
+       return 0;
 }
 #endif
 
@@ -236,7 +231,7 @@ void __init init_bcm1480_irqs(void)
        int i;
 
        for (i = 0; i < BCM1480_NR_IRQS; i++) {
-               set_irq_chip(i, &bcm1480_irq_type);
+               set_irq_chip_and_handler(i, &bcm1480_irq_type, handle_level_irq);
                bcm1480_irq_owner[i] = 0;
        }
 }