[PATCH] mm: swap: fix build warning when CONFIG_SWAP is not set

Kemeng Shi posted 1 patch 11 months, 2 weeks ago
include/linux/swap.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] mm: swap: fix build warning when CONFIG_SWAP is not set
Posted by Kemeng Shi 11 months, 2 weeks ago
Fix build warning that folio_alloc_swap is defined but not used when
CONFIG_SWAP is not set.

Fixes: b79768ab943cf ("mm, swap: simplify folio swap allocation")
Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
---
 include/linux/swap.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/swap.h b/include/linux/swap.h
index 3a68da686c4e..d1f5414ea537 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -587,7 +587,7 @@ static inline int swp_swapcount(swp_entry_t entry)
 	return 0;
 }
 
-static int folio_alloc_swap(struct folio *folio, gfp_t gfp_mask)
+static inline int folio_alloc_swap(struct folio *folio, gfp_t gfp_mask)
 {
 	return -EINVAL;
 }
-- 
2.30.0
Re: [PATCH] mm: swap: fix build warning when CONFIG_SWAP is not set
Posted by David Hildenbrand 11 months, 2 weeks ago
On 26.02.25 19:25, Kemeng Shi wrote:
> Fix build warning that folio_alloc_swap is defined but not used when
> CONFIG_SWAP is not set.
> 
> Fixes: b79768ab943cf ("mm, swap: simplify folio swap allocation")

Not a stable commit id from upstream / mm-stable, so this should be 
squashed into the original commit.

> Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
> ---
>   include/linux/swap.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/linux/swap.h b/include/linux/swap.h
> index 3a68da686c4e..d1f5414ea537 100644
> --- a/include/linux/swap.h
> +++ b/include/linux/swap.h
> @@ -587,7 +587,7 @@ static inline int swp_swapcount(swp_entry_t entry)
>   	return 0;
>   }
>   
> -static int folio_alloc_swap(struct folio *folio, gfp_t gfp_mask)
> +static inline int folio_alloc_swap(struct folio *folio, gfp_t gfp_mask)
>   {
>   	return -EINVAL;
>   }

LGTM

-- 
Cheers,

David / dhildenb