include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit...
[safe/jmp/linux-2.6] / arch / ia64 / kernel / iosapic.c
index 006ad36..7ded766 100644 (file)
@@ -86,6 +86,7 @@
 #include <linux/kernel.h>
 #include <linux/list.h>
 #include <linux/pci.h>
+#include <linux/slab.h>
 #include <linux/smp.h>
 #include <linux/string.h>
 #include <linux/bootmem.h>
@@ -329,7 +330,7 @@ unmask_irq (unsigned int irq)
 }
 
 
-static void
+static int
 iosapic_set_affinity(unsigned int irq, const struct cpumask *mask)
 {
 #ifdef CONFIG_SMP
@@ -343,15 +344,15 @@ iosapic_set_affinity(unsigned int irq, const struct cpumask *mask)
 
        cpu = cpumask_first_and(cpu_online_mask, mask);
        if (cpu >= nr_cpu_ids)
-               return;
+               return -1;
 
        if (irq_prepare_move(irq, cpu))
-               return;
+               return -1;
 
        dest = cpu_physical_id(cpu);
 
        if (!iosapic_intr_info[irq].count)
-               return;                 /* not an IOSAPIC interrupt */
+               return -1;                      /* not an IOSAPIC interrupt */
 
        set_irq_affinity_info(irq, dest, redir);
 
@@ -376,7 +377,9 @@ iosapic_set_affinity(unsigned int irq, const struct cpumask *mask)
                iosapic_write(iosapic, IOSAPIC_RTE_HIGH(rte_index), high32);
                iosapic_write(iosapic, IOSAPIC_RTE_LOW(rte_index), low32);
        }
+
 #endif
+       return 0;
 }
 
 /*
@@ -449,7 +452,7 @@ iosapic_startup_edge_irq (unsigned int irq)
 static void
 iosapic_ack_edge_irq (unsigned int irq)
 {
-       irq_desc_t *idesc = irq_desc + irq;
+       struct irq_desc *idesc = irq_desc + irq;
 
        irq_complete_move(irq);
        move_native_irq(irq);
@@ -507,7 +510,7 @@ static int iosapic_find_sharable_irq(unsigned long trigger, unsigned long pol)
        if (trigger == IOSAPIC_EDGE)
                return -EINVAL;
 
-       for (i = 0; i <= NR_IRQS; i++) {
+       for (i = 0; i < NR_IRQS; i++) {
                info = &iosapic_intr_info[i];
                if (info->trigger == trigger && info->polarity == pol &&
                    (info->dmode == IOSAPIC_FIXED ||
@@ -598,8 +601,8 @@ static int
 register_intr (unsigned int gsi, int irq, unsigned char delivery,
               unsigned long polarity, unsigned long trigger)
 {
-       irq_desc_t *idesc;
-       struct hw_interrupt_type *irq_type;
+       struct irq_desc *idesc;
+       struct irq_chip *irq_type;
        int index;
        struct iosapic_rte_info *rte;
 
@@ -648,7 +651,7 @@ register_intr (unsigned int gsi, int irq, unsigned char delivery,
 
        idesc = irq_desc + irq;
        if (irq_type != NULL && idesc->chip != irq_type) {
-               if (idesc->chip != &no_irq_type)
+               if (idesc->chip != &no_irq_chip)
                        printk(KERN_WARNING
                               "%s: changing vector %d from %s to %s\n",
                               __func__, irq_to_vector(irq),
@@ -791,12 +794,12 @@ iosapic_register_intr (unsigned int gsi,
                        goto unlock_iosapic_lock;
        }
 
-       spin_lock(&irq_desc[irq].lock);
+       raw_spin_lock(&irq_desc[irq].lock);
        dest = get_target_cpu(gsi, irq);
        dmode = choose_dmode();
        err = register_intr(gsi, irq, dmode, polarity, trigger);
        if (err < 0) {
-               spin_unlock(&irq_desc[irq].lock);
+               raw_spin_unlock(&irq_desc[irq].lock);
                irq = err;
                goto unlock_iosapic_lock;
        }
@@ -815,7 +818,7 @@ iosapic_register_intr (unsigned int gsi,
               (polarity == IOSAPIC_POL_HIGH ? "high" : "low"),
               cpu_logical_id(dest), dest, irq_to_vector(irq));
 
-       spin_unlock(&irq_desc[irq].lock);
+       raw_spin_unlock(&irq_desc[irq].lock);
  unlock_iosapic_lock:
        spin_unlock_irqrestore(&iosapic_lock, flags);
        return irq;
@@ -826,7 +829,7 @@ iosapic_unregister_intr (unsigned int gsi)
 {
        unsigned long flags;
        int irq, index;
-       irq_desc_t *idesc;
+       struct irq_desc *idesc;
        u32 low32;
        unsigned long trigger, polarity;
        unsigned int dest;
@@ -1070,6 +1073,10 @@ iosapic_init (unsigned long phys_addr, unsigned int gsi_base)
        }
 
        addr = ioremap(phys_addr, 0);
+       if (addr == NULL) {
+               spin_unlock_irqrestore(&iosapic_lock, flags);
+               return -ENOMEM;
+       }
        ver = iosapic_version(addr);
        if ((err = iosapic_check_gsi_range(gsi_base, ver))) {
                iounmap(addr);