powerpc/mm: Only keep one version of pmd_populate() functions on nohash/32
authorChristophe Leroy <christophe.leroy@c-s.fr>
Fri, 26 Apr 2019 15:58:10 +0000 (15:58 +0000)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 2 May 2019 15:20:25 +0000 (01:20 +1000)
Use IS_ENABLED(CONFIG_BOOKE) to make single versions of
pmd_populate() and pmd_populate_kernel()

Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/include/asm/nohash/32/pgalloc.h

index 4615801aa953dd13deaf88bf32ff59e30b62d78a..7ee8e27070f476f17763e52184243ffe5f9204dc 100644 (file)
@@ -25,37 +25,25 @@ static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
 #define __pmd_free_tlb(tlb,x,a)                do { } while (0)
 /* #define pgd_populate(mm, pmd, pte)      BUG() */
 
-#ifndef CONFIG_BOOKE
-
 static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmdp,
                                       pte_t *pte)
 {
-       *pmdp = __pmd(__pa(pte) | _PMD_PRESENT);
+       if (IS_ENABLED(CONFIG_BOOKE))
+               *pmdp = __pmd((unsigned long)pte | _PMD_PRESENT);
+       else
+               *pmdp = __pmd(__pa(pte) | _PMD_PRESENT);
 }
 
 static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmdp,
                                pgtable_t pte_page)
 {
-       *pmdp = __pmd(__pa(pte_page) | _PMD_USER | _PMD_PRESENT);
+       if (IS_ENABLED(CONFIG_BOOKE))
+               *pmdp = __pmd((unsigned long)pte_page | _PMD_PRESENT);
+       else
+               *pmdp = __pmd(__pa(pte_page) | _PMD_USER | _PMD_PRESENT);
 }
 
 #define pmd_pgtable(pmd) ((pgtable_t)pmd_page_vaddr(pmd))
-#else
-
-static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmdp,
-                                      pte_t *pte)
-{
-       *pmdp = __pmd((unsigned long)pte | _PMD_PRESENT);
-}
-
-static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmdp,
-                               pgtable_t pte_page)
-{
-       *pmdp = __pmd((unsigned long)pte_page | _PMD_PRESENT);
-}
-
-#define pmd_pgtable(pmd) ((pgtable_t)pmd_page_vaddr(pmd))
-#endif
 
 static inline void pgtable_free(void *table, unsigned index_size)
 {