aboutsummaryrefslogtreecommitdiff
path: root/arch/x86/kernel/genx2apic_cluster.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-01-28 15:20:18 +0100
committerIngo Molnar <mingo@elte.hu>2009-01-28 23:20:30 +0100
commitdebccb3e77be52cfc26c5a99e123c114c5c72aeb (patch)
tree27c015b45085b2042737d94a3fbd3c62fe143c37 /arch/x86/kernel/genx2apic_cluster.c
parent94af18755266edf46803564414d74f9621aaded8 (diff)
x86, apic: refactor ->cpu_mask_to_apicid*()
- spread out the namespace on a per driver basis - clean up the functions - get rid of macros Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/genx2apic_cluster.c')
-rw-r--r--arch/x86/kernel/genx2apic_cluster.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/arch/x86/kernel/genx2apic_cluster.c b/arch/x86/kernel/genx2apic_cluster.c
index c7557e05184..62f9fccf01d 100644
--- a/arch/x86/kernel/genx2apic_cluster.c
+++ b/arch/x86/kernel/genx2apic_cluster.c
@@ -111,21 +111,21 @@ static int x2apic_apic_id_registered(void)
static unsigned int x2apic_cpu_mask_to_apicid(const struct cpumask *cpumask)
{
- int cpu;
-
/*
* We're using fixed IRQ delivery, can only return one logical APIC ID.
* May as well be the first.
*/
- cpu = cpumask_first(cpumask);
+ int cpu = cpumask_first(cpumask);
+
if ((unsigned)cpu < nr_cpu_ids)
return per_cpu(x86_cpu_to_logical_apicid, cpu);
else
return BAD_APICID;
}
-static unsigned int x2apic_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
- const struct cpumask *andmask)
+static unsigned int
+x2apic_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
+ const struct cpumask *andmask)
{
int cpu;
@@ -133,11 +133,14 @@ static unsigned int x2apic_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
* We're using fixed IRQ delivery, can only return one logical APIC ID.
* May as well be the first.
*/
- for_each_cpu_and(cpu, cpumask, andmask)
+ for_each_cpu_and(cpu, cpumask, andmask) {
if (cpumask_test_cpu(cpu, cpu_online_mask))
break;
+ }
+
if (cpu < nr_cpu_ids)
return per_cpu(x86_cpu_to_logical_apicid, cpu);
+
return BAD_APICID;
}