diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-01-28 09:20:18 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-01-28 17:20:30 -0500 |
commit | debccb3e77be52cfc26c5a99e123c114c5c72aeb (patch) | |
tree | 27c015b45085b2042737d94a3fbd3c62fe143c37 /arch/x86/kernel/genx2apic_cluster.c | |
parent | 94af18755266edf46803564414d74f9621aaded8 (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.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/arch/x86/kernel/genx2apic_cluster.c b/arch/x86/kernel/genx2apic_cluster.c index c7557e051848..62f9fccf01dd 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) | |||
111 | 111 | ||
112 | static unsigned int x2apic_cpu_mask_to_apicid(const struct cpumask *cpumask) | 112 | static unsigned int x2apic_cpu_mask_to_apicid(const struct cpumask *cpumask) |
113 | { | 113 | { |
114 | int cpu; | ||
115 | |||
116 | /* | 114 | /* |
117 | * We're using fixed IRQ delivery, can only return one logical APIC ID. | 115 | * We're using fixed IRQ delivery, can only return one logical APIC ID. |
118 | * May as well be the first. | 116 | * May as well be the first. |
119 | */ | 117 | */ |
120 | cpu = cpumask_first(cpumask); | 118 | int cpu = cpumask_first(cpumask); |
119 | |||
121 | if ((unsigned)cpu < nr_cpu_ids) | 120 | if ((unsigned)cpu < nr_cpu_ids) |
122 | return per_cpu(x86_cpu_to_logical_apicid, cpu); | 121 | return per_cpu(x86_cpu_to_logical_apicid, cpu); |
123 | else | 122 | else |
124 | return BAD_APICID; | 123 | return BAD_APICID; |
125 | } | 124 | } |
126 | 125 | ||
127 | static unsigned int x2apic_cpu_mask_to_apicid_and(const struct cpumask *cpumask, | 126 | static unsigned int |
128 | const struct cpumask *andmask) | 127 | x2apic_cpu_mask_to_apicid_and(const struct cpumask *cpumask, |
128 | const struct cpumask *andmask) | ||
129 | { | 129 | { |
130 | int cpu; | 130 | int cpu; |
131 | 131 | ||
@@ -133,11 +133,14 @@ static unsigned int x2apic_cpu_mask_to_apicid_and(const struct cpumask *cpumask, | |||
133 | * We're using fixed IRQ delivery, can only return one logical APIC ID. | 133 | * We're using fixed IRQ delivery, can only return one logical APIC ID. |
134 | * May as well be the first. | 134 | * May as well be the first. |
135 | */ | 135 | */ |
136 | for_each_cpu_and(cpu, cpumask, andmask) | 136 | for_each_cpu_and(cpu, cpumask, andmask) { |
137 | if (cpumask_test_cpu(cpu, cpu_online_mask)) | 137 | if (cpumask_test_cpu(cpu, cpu_online_mask)) |
138 | break; | 138 | break; |
139 | } | ||
140 | |||
139 | if (cpu < nr_cpu_ids) | 141 | if (cpu < nr_cpu_ids) |
140 | return per_cpu(x86_cpu_to_logical_apicid, cpu); | 142 | return per_cpu(x86_cpu_to_logical_apicid, cpu); |
143 | |||
141 | return BAD_APICID; | 144 | return BAD_APICID; |
142 | } | 145 | } |
143 | 146 | ||