riscv: Fix build error if !CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION
authorAlexandre Ghiti <alexghiti@rivosinc.com>
Sun, 11 Feb 2024 08:36:40 +0000 (09:36 +0100)
committerPalmer Dabbelt <palmer@rivosinc.com>
Thu, 22 Feb 2024 20:28:25 +0000 (12:28 -0800)
commitfc325b1a915f6d0c821bfcea21fb3f1354c4323b
tree26ae7eaf07261eff9dd93fc60370428549221a1f
parentc21f014818600ae017f97ee087e7c136b1916aa7
riscv: Fix build error if !CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION

The new riscv specific arch_hugetlb_migration_supported() must be
guarded with a #ifdef CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION to avoid
the following build error:

In file included from include/linux/hugetlb.h:851,
                    from kernel/fork.c:52:
>> arch/riscv/include/asm/hugetlb.h:15:42: error: static declaration of 'arch_hugetlb_migration_supported' follows non-static declaration
      15 | #define arch_hugetlb_migration_supported arch_hugetlb_migration_supported
         |                                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/hugetlb.h:916:20: note: in expansion of macro 'arch_hugetlb_migration_supported'
     916 | static inline bool arch_hugetlb_migration_supported(struct hstate *h)
         |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/riscv/include/asm/hugetlb.h:14:6: note: previous declaration of 'arch_hugetlb_migration_supported' with type 'bool(struct hstate *)' {aka '_Bool(struct hstate *)'}
      14 | bool arch_hugetlb_migration_supported(struct hstate *h);
         |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202402110258.CV51JlEI-lkp@intel.com/
Fixes: ce68c035457b ("riscv: Fix arch_hugetlb_migration_supported() for NAPOT")
Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Link: https://lore.kernel.org/r/20240211083640.756583-1-alexghiti@rivosinc.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
arch/riscv/include/asm/hugetlb.h
arch/riscv/mm/hugetlbpage.c