]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - arch/powerpc/kernel/irq.c
powerpc: Fix logic error in fixup_irqs
[net-next-2.6.git] / arch / powerpc / kernel / irq.c
index 066bd31551d5414fb0a7a43ed85964c64665f042..77be3d058a658fa447a2235a8441d320be245d20 100644 (file)
@@ -284,37 +284,42 @@ u64 arch_irq_stat_cpu(unsigned int cpu)
 }
 
 #ifdef CONFIG_HOTPLUG_CPU
-void fixup_irqs(cpumask_t map)
+void fixup_irqs(const struct cpumask *map)
 {
        struct irq_desc *desc;
        unsigned int irq;
        static int warned;
+       cpumask_var_t mask;
 
-       for_each_irq(irq) {
-               cpumask_t mask;
+       alloc_cpumask_var(&mask, GFP_KERNEL);
 
+       for_each_irq(irq) {
                desc = irq_to_desc(irq);
-               if (desc && desc->status & IRQ_PER_CPU)
+               if (!desc)
                        continue;
 
-               cpumask_and(&mask, desc->affinity, &map);
-               if (any_online_cpu(mask) == NR_CPUS) {
+               if (desc->status & IRQ_PER_CPU)
+                       continue;
+
+               cpumask_and(mask, desc->affinity, map);
+               if (cpumask_any(mask) >= nr_cpu_ids) {
                        printk("Breaking affinity for irq %i\n", irq);
-                       mask = map;
+                       cpumask_copy(mask, map);
                }
                if (desc->chip->set_affinity)
-                       desc->chip->set_affinity(irq, &mask);
+                       desc->chip->set_affinity(irq, mask);
                else if (desc->action && !(warned++))
                        printk("Cannot set affinity for irq %i\n", irq);
        }
 
+       free_cpumask_var(mask);
+
        local_irq_enable();
        mdelay(1);
        local_irq_disable();
 }
 #endif
 
-#ifdef CONFIG_IRQSTACKS
 static inline void handle_one_irq(unsigned int irq)
 {
        struct thread_info *curtp, *irqtp;
@@ -355,12 +360,6 @@ static inline void handle_one_irq(unsigned int irq)
        if (irqtp->flags)
                set_bits(irqtp->flags, &curtp->flags);
 }
-#else
-static inline void handle_one_irq(unsigned int irq)
-{
-       generic_handle_irq(irq);
-}
-#endif
 
 static inline void check_stack_overflow(void)
 {
@@ -452,7 +451,6 @@ void exc_lvl_ctx_init(void)
 }
 #endif
 
-#ifdef CONFIG_IRQSTACKS
 struct thread_info *softirq_ctx[NR_CPUS] __read_mostly;
 struct thread_info *hardirq_ctx[NR_CPUS] __read_mostly;
 
@@ -489,10 +487,6 @@ static inline void do_softirq_onstack(void)
        irqtp->task = NULL;
 }
 
-#else
-#define do_softirq_onstack()   __do_softirq()
-#endif /* CONFIG_IRQSTACKS */
-
 void do_softirq(void)
 {
        unsigned long flags;