[S390] smp: introduce LC_ORDER and simplify lowcore handling
authorHeiko Carstens <heiko.carstens@de.ibm.com>
Tue, 22 Sep 2009 20:58:49 +0000 (22:58 +0200)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Tue, 22 Sep 2009 20:58:45 +0000 (22:58 +0200)
Removes a couple of simple code duplications. But before I have to do
this again, just simplify it.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
arch/s390/include/asm/lowcore.h
arch/s390/kernel/smp.c

index 6bc9426a6fbf95b732d3d03a4c8397baa28ebd65..8c5570366a0e8e1669eed2214ec7ac3cde608b48 100644 (file)
@@ -189,6 +189,12 @@ union save_area {
 #define SAVE_AREA_BASE SAVE_AREA_BASE_S390X
 #endif
 
+#ifndef __s390x__
+#define LC_ORDER 0
+#else
+#define LC_ORDER 1
+#endif
+
 struct _lowcore
 {
 #ifndef __s390x__
index 56c16876b9190b067e71ddde1865566e6d17261f..6f14734abe72f59d6e8133ee2e33665abd6cac0a 100644 (file)
@@ -475,10 +475,8 @@ static int __cpuinit smp_alloc_lowcore(int cpu)
 {
        unsigned long async_stack, panic_stack;
        struct _lowcore *lowcore;
-       int lc_order;
 
-       lc_order = sizeof(long) == 8 ? 1 : 0;
-       lowcore = (void *) __get_free_pages(GFP_KERNEL | GFP_DMA, lc_order);
+       lowcore = (void *) __get_free_pages(GFP_KERNEL | GFP_DMA, LC_ORDER);
        if (!lowcore)
                return -ENOMEM;
        async_stack = __get_free_pages(GFP_KERNEL, ASYNC_ORDER);
@@ -509,16 +507,14 @@ static int __cpuinit smp_alloc_lowcore(int cpu)
 out:
        free_page(panic_stack);
        free_pages(async_stack, ASYNC_ORDER);
-       free_pages((unsigned long) lowcore, lc_order);
+       free_pages((unsigned long) lowcore, LC_ORDER);
        return -ENOMEM;
 }
 
 static void smp_free_lowcore(int cpu)
 {
        struct _lowcore *lowcore;
-       int lc_order;
 
-       lc_order = sizeof(long) == 8 ? 1 : 0;
        lowcore = lowcore_ptr[cpu];
 #ifndef CONFIG_64BIT
        if (MACHINE_HAS_IEEE)
@@ -528,7 +524,7 @@ static void smp_free_lowcore(int cpu)
 #endif
        free_page(lowcore->panic_stack - PAGE_SIZE);
        free_pages(lowcore->async_stack - ASYNC_SIZE, ASYNC_ORDER);
-       free_pages((unsigned long) lowcore, lc_order);
+       free_pages((unsigned long) lowcore, LC_ORDER);
        lowcore_ptr[cpu] = NULL;
 }
 
@@ -664,7 +660,6 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
        unsigned long async_stack, panic_stack;
        struct _lowcore *lowcore;
        unsigned int cpu;
-       int lc_order;
 
        smp_detect_cpus();
 
@@ -674,8 +669,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
        print_cpu_info();
 
        /* Reallocate current lowcore, but keep its contents. */
-       lc_order = sizeof(long) == 8 ? 1 : 0;
-       lowcore = (void *) __get_free_pages(GFP_KERNEL | GFP_DMA, lc_order);
+       lowcore = (void *) __get_free_pages(GFP_KERNEL | GFP_DMA, LC_ORDER);
        panic_stack = __get_free_page(GFP_KERNEL);
        async_stack = __get_free_pages(GFP_KERNEL, ASYNC_ORDER);
        BUG_ON(!lowcore || !panic_stack || !async_stack);