diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2007-02-23 06:11:56 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-26 13:34:07 -0500 |
commit | fc5d56f987170cda1d344095c4df65a60a3e9820 (patch) | |
tree | d73ca9b3f20112c42e515127c04c8e3be0bfe178 /arch/x86_64 | |
parent | ea3d5226f52ef30f52aa0a04f47f5919c7facacf (diff) |
[PATCH] x86_64 irq: Simplfy __assign_irq_vector
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>
Diffstat (limited to 'arch/x86_64')
-rw-r--r-- | arch/x86_64/kernel/io_apic.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/arch/x86_64/kernel/io_apic.c b/arch/x86_64/kernel/io_apic.c index 950682f35766..357b354921c1 100644 --- a/arch/x86_64/kernel/io_apic.c +++ b/arch/x86_64/kernel/io_apic.c | |||
@@ -685,6 +685,7 @@ static int __assign_irq_vector(int irq, cpumask_t mask, cpumask_t *result) | |||
685 | * 0x80, because int 0x80 is hm, kind of importantish. ;) | 685 | * 0x80, because int 0x80 is hm, kind of importantish. ;) |
686 | */ | 686 | */ |
687 | static int current_vector = FIRST_DEVICE_VECTOR, current_offset = 0; | 687 | static int current_vector = FIRST_DEVICE_VECTOR, current_offset = 0; |
688 | cpumask_t old_mask = CPU_MASK_NONE; | ||
688 | int old_vector = -1; | 689 | int old_vector = -1; |
689 | int cpu; | 690 | int cpu; |
690 | 691 | ||
@@ -699,11 +700,12 @@ static int __assign_irq_vector(int irq, cpumask_t mask, cpumask_t *result) | |||
699 | cpus_and(*result, irq_domain[irq], mask); | 700 | cpus_and(*result, irq_domain[irq], mask); |
700 | if (!cpus_empty(*result)) | 701 | if (!cpus_empty(*result)) |
701 | return old_vector; | 702 | return old_vector; |
703 | cpus_and(old_mask, irq_domain[irq], cpu_online_map); | ||
702 | } | 704 | } |
703 | 705 | ||
704 | for_each_cpu_mask(cpu, mask) { | 706 | for_each_cpu_mask(cpu, mask) { |
705 | cpumask_t domain, new_mask; | 707 | cpumask_t domain, new_mask; |
706 | int new_cpu; | 708 | int new_cpu, old_cpu; |
707 | int vector, offset; | 709 | int vector, offset; |
708 | 710 | ||
709 | domain = vector_allocation_domain(cpu); | 711 | domain = vector_allocation_domain(cpu); |
@@ -728,13 +730,8 @@ next: | |||
728 | /* Found one! */ | 730 | /* Found one! */ |
729 | current_vector = vector; | 731 | current_vector = vector; |
730 | current_offset = offset; | 732 | current_offset = offset; |
731 | if (old_vector >= 0) { | 733 | for_each_cpu_mask(old_cpu, old_mask) |
732 | cpumask_t old_mask; | 734 | per_cpu(vector_irq, old_cpu)[old_vector] = -1; |
733 | int old_cpu; | ||
734 | cpus_and(old_mask, irq_domain[irq], cpu_online_map); | ||
735 | for_each_cpu_mask(old_cpu, old_mask) | ||
736 | per_cpu(vector_irq, old_cpu)[old_vector] = -1; | ||
737 | } | ||
738 | for_each_cpu_mask(new_cpu, new_mask) | 735 | for_each_cpu_mask(new_cpu, new_mask) |
739 | per_cpu(vector_irq, new_cpu)[vector] = irq; | 736 | per_cpu(vector_irq, new_cpu)[vector] = irq; |
740 | irq_vector[irq] = vector; | 737 | irq_vector[irq] = vector; |