aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/apic
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@openvz.org>2009-08-24 13:53:39 -0400
committerIngo Molnar <mingo@elte.hu>2009-08-26 02:16:38 -0400
commitffc438366c2660a6a811b94ba33229bf217f8254 (patch)
treee11a19fc4b206040aa8f68e8a6a15ffddfb3b168 /arch/x86/kernel/apic
parent8f3e1df48baf728bbb0f242c9dff9c9d7108218a (diff)
x86, ioapic: Get rid of needless check and simplify ioapic_setup_resources()
alloc_bootmem() already panics on allocation failure. There is no need to check the result. Also there is a way to unbind global variable from its body and use it as a parameter which allow us to simplify ioapic_init_mappings as well -- "for" cycle already uses nr_ioapics as a conditional variable and there is no need to check if ioapic_setup_resources was returning NULL again. Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org> Cc: Yinghai Lu <yinghai@kernel.org> LKML-Reference: <20090824175551.493629148@openvz.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/apic')
-rw-r--r--arch/x86/kernel/apic/io_apic.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index 2999f3dd5889..d836b4d347e6 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -4053,7 +4053,7 @@ void __init setup_ioapic_dest(void)
4053 4053
4054static struct resource *ioapic_resources; 4054static struct resource *ioapic_resources;
4055 4055
4056static struct resource * __init ioapic_setup_resources(void) 4056static struct resource * __init ioapic_setup_resources(int nr_ioapics)
4057{ 4057{
4058 unsigned long n; 4058 unsigned long n;
4059 struct resource *res; 4059 struct resource *res;
@@ -4069,15 +4069,13 @@ static struct resource * __init ioapic_setup_resources(void)
4069 mem = alloc_bootmem(n); 4069 mem = alloc_bootmem(n);
4070 res = (void *)mem; 4070 res = (void *)mem;
4071 4071
4072 if (mem != NULL) { 4072 mem += sizeof(struct resource) * nr_ioapics;
4073 mem += sizeof(struct resource) * nr_ioapics;
4074 4073
4075 for (i = 0; i < nr_ioapics; i++) { 4074 for (i = 0; i < nr_ioapics; i++) {
4076 res[i].name = mem; 4075 res[i].name = mem;
4077 res[i].flags = IORESOURCE_MEM | IORESOURCE_BUSY; 4076 res[i].flags = IORESOURCE_MEM | IORESOURCE_BUSY;
4078 sprintf(mem, "IOAPIC %u", i); 4077 sprintf(mem, "IOAPIC %u", i);
4079 mem += IOAPIC_RESOURCE_NAME_SIZE; 4078 mem += IOAPIC_RESOURCE_NAME_SIZE;
4080 }
4081 } 4079 }
4082 4080
4083 ioapic_resources = res; 4081 ioapic_resources = res;
@@ -4091,7 +4089,7 @@ void __init ioapic_init_mappings(void)
4091 struct resource *ioapic_res; 4089 struct resource *ioapic_res;
4092 int i; 4090 int i;
4093 4091
4094 ioapic_res = ioapic_setup_resources(); 4092 ioapic_res = ioapic_setup_resources(nr_ioapics);
4095 for (i = 0; i < nr_ioapics; i++) { 4093 for (i = 0; i < nr_ioapics; i++) {
4096 if (smp_found_config) { 4094 if (smp_found_config) {
4097 ioapic_phys = mp_ioapics[i].apicaddr; 4095 ioapic_phys = mp_ioapics[i].apicaddr;
@@ -4120,11 +4118,9 @@ fake_ioapic_page:
4120 __fix_to_virt(idx), ioapic_phys); 4118 __fix_to_virt(idx), ioapic_phys);
4121 idx++; 4119 idx++;
4122 4120
4123 if (ioapic_res != NULL) { 4121 ioapic_res->start = ioapic_phys;
4124 ioapic_res->start = ioapic_phys; 4122 ioapic_res->end = ioapic_phys + (4 * 1024) - 1;
4125 ioapic_res->end = ioapic_phys + (4 * 1024) - 1; 4123 ioapic_res++;
4126 ioapic_res++;
4127 }
4128 } 4124 }
4129} 4125}
4130 4126