Skip to content

Commit c05995b

Browse files
xzpeterakpm00
authored andcommitted
mm/treewide: align up pXd_leaf() retval across archs
Even if pXd_leaf() API is defined globally, it's not clear on the retval, and there are three types used (bool, int, unsigned log). Always return a boolean for pXd_leaf() APIs. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Peter Xu <[email protected]> Suggested-by: Jason Gunthorpe <[email protected]> Reviewed-by: Jason Gunthorpe <[email protected]> Reviewed-by: Mike Rapoport (IBM) <[email protected]> Cc: Alexander Potapenko <[email protected]> Cc: Andrey Konovalov <[email protected]> Cc: Andrey Ryabinin <[email protected]> Cc: "Aneesh Kumar K.V" <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Christophe Leroy <[email protected]> Cc: Dave Hansen <[email protected]> Cc: Dmitry Vyukov <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Kirill A. Shutemov <[email protected]> Cc: Michael Ellerman <[email protected]> Cc: Muchun Song <[email protected]> Cc: "Naveen N. Rao" <[email protected]> Cc: Nicholas Piggin <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Vincenzo Frascino <[email protected]> Cc: Yang Shi <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent e72c7c2 commit c05995b

File tree

6 files changed

+14
-14
lines changed

6 files changed

+14
-14
lines changed

arch/riscv/include/asm/pgtable-64.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ static inline int pud_bad(pud_t pud)
190190
}
191191

192192
#define pud_leaf pud_leaf
193-
static inline int pud_leaf(pud_t pud)
193+
static inline bool pud_leaf(pud_t pud)
194194
{
195195
return pud_present(pud) && (pud_val(pud) & _PAGE_LEAF);
196196
}

arch/riscv/include/asm/pgtable.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ static inline int pmd_bad(pmd_t pmd)
241241
}
242242

243243
#define pmd_leaf pmd_leaf
244-
static inline int pmd_leaf(pmd_t pmd)
244+
static inline bool pmd_leaf(pmd_t pmd)
245245
{
246246
return pmd_present(pmd) && (pmd_val(pmd) & _PAGE_LEAF);
247247
}

arch/s390/include/asm/pgtable.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -706,15 +706,15 @@ static inline int pud_none(pud_t pud)
706706
}
707707

708708
#define pud_leaf pud_leaf
709-
static inline int pud_leaf(pud_t pud)
709+
static inline bool pud_leaf(pud_t pud)
710710
{
711711
if ((pud_val(pud) & _REGION_ENTRY_TYPE_MASK) != _REGION_ENTRY_TYPE_R3)
712712
return 0;
713713
return !!(pud_val(pud) & _REGION3_ENTRY_LARGE);
714714
}
715715

716716
#define pmd_leaf pmd_leaf
717-
static inline int pmd_leaf(pmd_t pmd)
717+
static inline bool pmd_leaf(pmd_t pmd)
718718
{
719719
return (pmd_val(pmd) & _SEGMENT_ENTRY_LARGE) != 0;
720720
}

arch/sparc/include/asm/pgtable_64.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,7 @@ static inline unsigned long pte_special(pte_t pte)
681681
}
682682

683683
#define pmd_leaf pmd_leaf
684-
static inline unsigned long pmd_leaf(pmd_t pmd)
684+
static inline bool pmd_leaf(pmd_t pmd)
685685
{
686686
pte_t pte = __pte(pmd_val(pmd));
687687

@@ -868,7 +868,7 @@ static inline pmd_t *pud_pgtable(pud_t pud)
868868
#define p4d_page(p4d) NULL
869869

870870
#define pud_leaf pud_leaf
871-
static inline unsigned long pud_leaf(pud_t pud)
871+
static inline bool pud_leaf(pud_t pud)
872872
{
873873
pte_t pte = __pte(pud_val(pud));
874874

arch/x86/include/asm/pgtable.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ static inline unsigned long pgd_pfn(pgd_t pgd)
252252
}
253253

254254
#define p4d_leaf p4d_leaf
255-
static inline int p4d_leaf(p4d_t p4d)
255+
static inline bool p4d_leaf(p4d_t p4d)
256256
{
257257
/* No 512 GiB pages yet */
258258
return 0;
@@ -261,7 +261,7 @@ static inline int p4d_leaf(p4d_t p4d)
261261
#define pte_page(pte) pfn_to_page(pte_pfn(pte))
262262

263263
#define pmd_leaf pmd_leaf
264-
static inline int pmd_leaf(pmd_t pte)
264+
static inline bool pmd_leaf(pmd_t pte)
265265
{
266266
return pmd_flags(pte) & _PAGE_PSE;
267267
}
@@ -1086,7 +1086,7 @@ static inline pmd_t *pud_pgtable(pud_t pud)
10861086
#define pud_page(pud) pfn_to_page(pud_pfn(pud))
10871087

10881088
#define pud_leaf pud_leaf
1089-
static inline int pud_leaf(pud_t pud)
1089+
static inline bool pud_leaf(pud_t pud)
10901090
{
10911091
return (pud_val(pud) & (_PAGE_PSE | _PAGE_PRESENT)) ==
10921092
(_PAGE_PSE | _PAGE_PRESENT);
@@ -1413,7 +1413,7 @@ static inline bool pgdp_maps_userspace(void *__ptr)
14131413
}
14141414

14151415
#define pgd_leaf pgd_leaf
1416-
static inline int pgd_leaf(pgd_t pgd) { return 0; }
1416+
static inline bool pgd_leaf(pgd_t pgd) { return false; }
14171417

14181418
#ifdef CONFIG_PAGE_TABLE_ISOLATION
14191419
/*

include/linux/pgtable.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1777,16 +1777,16 @@ typedef unsigned int pgtbl_mod_mask;
17771777
* Only meaningful when called on a valid entry.
17781778
*/
17791779
#ifndef pgd_leaf
1780-
#define pgd_leaf(x) 0
1780+
#define pgd_leaf(x) false
17811781
#endif
17821782
#ifndef p4d_leaf
1783-
#define p4d_leaf(x) 0
1783+
#define p4d_leaf(x) false
17841784
#endif
17851785
#ifndef pud_leaf
1786-
#define pud_leaf(x) 0
1786+
#define pud_leaf(x) false
17871787
#endif
17881788
#ifndef pmd_leaf
1789-
#define pmd_leaf(x) 0
1789+
#define pmd_leaf(x) false
17901790
#endif
17911791

17921792
#ifndef pgd_leaf_size

0 commit comments

Comments
 (0)