]> err.no Git - linux-2.6/commitdiff
[PATCH] x86_64 irq: Simplfy __assign_irq_vector
authorEric W. Biederman <ebiederm@xmission.com>
Fri, 23 Feb 2007 11:11:56 +0000 (04:11 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Mon, 26 Feb 2007 18:34:07 +0000 (10:34 -0800)
By precomputing old_mask I remove an extra if statement, remove an
indentation level and make the code slightly easier to read.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/x86_64/kernel/io_apic.c

index 950682f3576697b3fa7bcc8b916be3b8a3547c8d..357b354921c13251d0f467b37683bedcf81fff05 100644 (file)
@@ -685,6 +685,7 @@ static int __assign_irq_vector(int irq, cpumask_t mask, cpumask_t *result)
         * 0x80, because int 0x80 is hm, kind of importantish. ;)
         */
        static int current_vector = FIRST_DEVICE_VECTOR, current_offset = 0;
+       cpumask_t old_mask = CPU_MASK_NONE;
        int old_vector = -1;
        int cpu;
 
@@ -699,11 +700,12 @@ static int __assign_irq_vector(int irq, cpumask_t mask, cpumask_t *result)
                cpus_and(*result, irq_domain[irq], mask);
                if (!cpus_empty(*result))
                        return old_vector;
+               cpus_and(old_mask, irq_domain[irq], cpu_online_map);
        }
 
        for_each_cpu_mask(cpu, mask) {
                cpumask_t domain, new_mask;
-               int new_cpu;
+               int new_cpu, old_cpu;
                int vector, offset;
 
                domain = vector_allocation_domain(cpu);
@@ -728,13 +730,8 @@ next:
                /* Found one! */
                current_vector = vector;
                current_offset = offset;
-               if (old_vector >= 0) {
-                       cpumask_t old_mask;
-                       int old_cpu;
-                       cpus_and(old_mask, irq_domain[irq], cpu_online_map);
-                       for_each_cpu_mask(old_cpu, old_mask)
-                               per_cpu(vector_irq, old_cpu)[old_vector] = -1;
-               }
+               for_each_cpu_mask(old_cpu, old_mask)
+                       per_cpu(vector_irq, old_cpu)[old_vector] = -1;
                for_each_cpu_mask(new_cpu, new_mask)
                        per_cpu(vector_irq, new_cpu)[vector] = irq;
                irq_vector[irq] = vector;