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_phys.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_phys.c')
-rw-r--r-- | arch/x86/kernel/genx2apic_phys.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/arch/x86/kernel/genx2apic_phys.c b/arch/x86/kernel/genx2apic_phys.c index 80cba49cfd89..3da1675b2604 100644 --- a/arch/x86/kernel/genx2apic_phys.c +++ b/arch/x86/kernel/genx2apic_phys.c | |||
@@ -110,21 +110,21 @@ static int x2apic_apic_id_registered(void) | |||
110 | 110 | ||
111 | static unsigned int x2apic_cpu_mask_to_apicid(const struct cpumask *cpumask) | 111 | static unsigned int x2apic_cpu_mask_to_apicid(const struct cpumask *cpumask) |
112 | { | 112 | { |
113 | int cpu; | ||
114 | |||
115 | /* | 113 | /* |
116 | * We're using fixed IRQ delivery, can only return one phys APIC ID. | 114 | * We're using fixed IRQ delivery, can only return one phys APIC ID. |
117 | * May as well be the first. | 115 | * May as well be the first. |
118 | */ | 116 | */ |
119 | cpu = cpumask_first(cpumask); | 117 | int cpu = cpumask_first(cpumask); |
118 | |||
120 | if ((unsigned)cpu < nr_cpu_ids) | 119 | if ((unsigned)cpu < nr_cpu_ids) |
121 | return per_cpu(x86_cpu_to_apicid, cpu); | 120 | return per_cpu(x86_cpu_to_apicid, cpu); |
122 | else | 121 | else |
123 | return BAD_APICID; | 122 | return BAD_APICID; |
124 | } | 123 | } |
125 | 124 | ||
126 | static unsigned int x2apic_cpu_mask_to_apicid_and(const struct cpumask *cpumask, | 125 | static unsigned int |
127 | const struct cpumask *andmask) | 126 | x2apic_cpu_mask_to_apicid_and(const struct cpumask *cpumask, |
127 | const struct cpumask *andmask) | ||
128 | { | 128 | { |
129 | int cpu; | 129 | int cpu; |
130 | 130 | ||
@@ -132,11 +132,14 @@ static unsigned int x2apic_cpu_mask_to_apicid_and(const struct cpumask *cpumask, | |||
132 | * We're using fixed IRQ delivery, can only return one phys APIC ID. | 132 | * We're using fixed IRQ delivery, can only return one phys APIC ID. |
133 | * May as well be the first. | 133 | * May as well be the first. |
134 | */ | 134 | */ |
135 | for_each_cpu_and(cpu, cpumask, andmask) | 135 | for_each_cpu_and(cpu, cpumask, andmask) { |
136 | if (cpumask_test_cpu(cpu, cpu_online_mask)) | 136 | if (cpumask_test_cpu(cpu, cpu_online_mask)) |
137 | break; | 137 | break; |
138 | } | ||
139 | |||
138 | if (cpu < nr_cpu_ids) | 140 | if (cpu < nr_cpu_ids) |
139 | return per_cpu(x86_cpu_to_apicid, cpu); | 141 | return per_cpu(x86_cpu_to_apicid, cpu); |
142 | |||
140 | return BAD_APICID; | 143 | return BAD_APICID; |
141 | } | 144 | } |
142 | 145 | ||