From c7b3d6e0a15fd4e85a8f7333abb2220a54c052e5 Mon Sep 17 00:00:00 2001 From: Miaohe Lin Date: Thu, 28 Apr 2022 17:21:55 +0800 Subject: [PATCH] mm/swap: fix implicit function declarations of is_swapin_error_entry Kernel test robot reported the error of calling to undeclared function is_swapin_error_entry. Fix it by wrapping up is_swapin_error_entry with CONFIG_SWAP. Reported-by: kernel test robot Signed-off-by: Miaohe Lin --- include/linux/swap.h | 4 ++++ include/linux/swapops.h | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/include/linux/swap.h b/include/linux/swap.h index b82c196d8867..f3d44252e477 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -55,10 +55,14 @@ static inline int current_is_kswapd(void) * actions on faults. */ +#ifdef CONFIG_SWAP #define SWP_SWAPIN_ERROR_NUM 1 #define SWP_SWAPIN_ERROR (MAX_SWAPFILES + SWP_HWPOISON_NUM + \ SWP_MIGRATION_NUM + SWP_DEVICE_NUM + \ SWP_PTE_MARKER_NUM) +#else +#define SWP_SWAPIN_ERROR_NUM 0 +#endif /* * PTE markers are used to persist information onto PTEs that are mapped with * file-backed memories. As its name "PTE" hints, it should only be applied to diff --git a/include/linux/swapops.h b/include/linux/swapops.h index ffc9f19ab6fb..af6e6fb4b8e6 100644 --- a/include/linux/swapops.h +++ b/include/linux/swapops.h @@ -108,6 +108,7 @@ static inline void *swp_to_radix_entry(swp_entry_t entry) return xa_mk_value(entry.val); } +#ifdef CONFIG_SWAP static inline swp_entry_t make_swapin_error_entry(struct page *page) { return swp_entry(SWP_SWAPIN_ERROR, page_to_pfn(page)); @@ -117,6 +118,12 @@ static inline int is_swapin_error_entry(swp_entry_t entry) { return swp_type(entry) == SWP_SWAPIN_ERROR; } +#else +static inline int is_swapin_error_entry(swp_entry_t entry) +{ + return 0; +} +#endif #if IS_ENABLED(CONFIG_DEVICE_PRIVATE) static inline swp_entry_t make_readable_device_private_entry(pgoff_t offset) -- 2.23.0