Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932451AbXBWLNK (ORCPT ); Fri, 23 Feb 2007 06:13:10 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S932471AbXBWLNJ (ORCPT ); Fri, 23 Feb 2007 06:13:09 -0500 Received: from ebiederm.dsl.xmission.com ([166.70.28.69]:33195 "EHLO ebiederm.dsl.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932451AbXBWLNI (ORCPT ); Fri, 23 Feb 2007 06:13:08 -0500 From: ebiederm@xmission.com (Eric W. Biederman) To: Andrew Morton Cc: linux-kernel@vger.kernel.org, Zwane Mwaikambo , Ashok Raj , Ingo Molnar , "Lu, Yinghai" , Natalie Protasevich , Andi Kleen , "Siddha, Suresh B" , Linus Torvalds Subject: [PATCH 01/14] x86_64 irq: Simplfy __assign_irq_vector References: <200701221116.13154.luigi.genoni@pirelli.com> <200702021848.55921.luigi.genoni@pirelli.com> <200702021905.39922.luigi.genoni@pirelli.com> <20070206073616.GA15016@elte.hu> <20070206222523.GA11602@elte.hu> Date: Fri, 23 Feb 2007 04:11:56 -0700 In-Reply-To: (Eric W. Biederman's message of "Fri, 23 Feb 2007 04:10:36 -0700") Message-ID: User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1996 Lines: 59 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 --- 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 950682f..357b354 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) * 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; -- 1.5.0.g53756 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/