[POWERPC] Tidy up CONFIG_PPC_MM_SLICES code
authorStephen Rothwell <sfr@canb.auug.org.au>
Wed, 15 Aug 2007 06:51:18 +0000 (16:51 +1000)
committerPaul Mackerras <paulus@samba.org>
Fri, 17 Aug 2007 01:01:59 +0000 (11:01 +1000)
This removes some of the #ifdefs from .c files.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/mm/hash_utils_64.c
arch/powerpc/mm/mmu_context_64.c
include/asm-powerpc/page_64.h

index c74af42eb9c1e87c3e2610193c480ab095b4b1c1..d525f2eba3138ab28e13596363afe2da9261961a 100644 (file)
@@ -601,13 +601,7 @@ static void demote_segment_4k(struct mm_struct *mm, unsigned long addr)
 {
        if (mm->context.user_psize == MMU_PAGE_4K)
                return;
-#ifdef CONFIG_PPC_MM_SLICES
        slice_set_user_psize(mm, MMU_PAGE_4K);
-#else /* CONFIG_PPC_MM_SLICES */
-       mm->context.user_psize = MMU_PAGE_4K;
-       mm->context.sllp = SLB_VSID_USER | mmu_psize_defs[MMU_PAGE_4K].sllp;
-#endif /* CONFIG_PPC_MM_SLICES */
-
 #ifdef CONFIG_SPU_BASE
        spu_flush_all_slbs(mm);
 #endif
index 901ea765f14618ef2e469fa78eb5bb78b877b396..1db38ba1f544e003a40c48a9b5652834bfa4bf27 100644 (file)
@@ -49,18 +49,12 @@ again:
                return -ENOMEM;
        }
 
-#ifdef CONFIG_PPC_MM_SLICES
        /* The old code would re-promote on fork, we don't do that
         * when using slices as it could cause problem promoting slices
         * that have been forced down to 4K
         */
-       if (mm->context.id == 0)
+       if (slice_mm_new_context(mm))
                slice_set_user_psize(mm, mmu_virtual_psize);
-#else
-       mm->context.user_psize = mmu_virtual_psize;
-       mm->context.sllp = SLB_VSID_USER |
-               mmu_psize_defs[mmu_virtual_psize].sllp;
-#endif
        mm->context.id = index;
 
        return 0;
index 3448a3d4bc64efc74d84a9c3e337a8989b108fd9..4ceb1132c480ed75d116c6970d137be694dcf29c 100644 (file)
@@ -121,6 +121,7 @@ extern unsigned int get_slice_psize(struct mm_struct *mm,
 
 extern void slice_init_context(struct mm_struct *mm, unsigned int psize);
 extern void slice_set_user_psize(struct mm_struct *mm, unsigned int psize);
+#define slice_mm_new_context(mm)       ((mm)->context.id == 0)
 
 #define ARCH_HAS_HUGEPAGE_ONLY_RANGE
 extern int is_hugepage_only_range(struct mm_struct *m,
@@ -130,6 +131,12 @@ extern int is_hugepage_only_range(struct mm_struct *m,
 #endif /* __ASSEMBLY__ */
 #else
 #define slice_init()
+#define slice_set_user_psize(mm, psize)                \
+do {                                           \
+       (mm)->context.user_psize = (psize);     \
+       (mm)->context.sllp = SLB_VSID_USER | mmu_psize_defs[(psize)].sllp; \
+} while (0)
+#define slice_mm_new_context(mm)       1
 #endif /* CONFIG_PPC_MM_SLICES */
 
 #ifdef CONFIG_HUGETLB_PAGE