Re: [PATCH 1/1] LoongArch: Add missing linux/mm.h include in asm/io.h

From: Huacai Chen

Date: Thu May 21 2026 - 03:09:45 EST


On Thu, May 21, 2026 at 2:33 PM George Guo <dongtai.guo@xxxxxxxxx> wrote:
>
> From: George Guo <guodongtai@xxxxxxxxxx>
>
> When CONFIG_KFENCE is enabled, the virt_to_phys() and phys_to_virt()
> macros in arch/loongarch/include/asm/io.h expand to use offset_in_page()
> and page_address(), both of which are declared in <linux/mm.h>.
>
> Without this include, any translation unit that includes <asm/io.h> and
> expands these macros with CONFIG_KFENCE=y will fail to build:
>
> asm/io.h: error: implicit declaration of function 'offset_in_page'
> asm/io.h: error: implicit declaration of function 'page_address'
>From which .c file the warning is? I can't reproduce it.

Huacai

>
> Add the missing include to fix these build errors.
>
> Fixes: 0ca84aeaee15 ("LoongArch: Make {virt, phys, page, pfn} translation work with KFENCE")
> Co-developed-by: Kexin Liu <liukexin@xxxxxxxxxx>
> Signed-off-by: Kexin Liu <liukexin@xxxxxxxxxx>
> Signed-off-by: George Guo <guodongtai@xxxxxxxxxx>
> ---
> arch/loongarch/include/asm/io.h | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/arch/loongarch/include/asm/io.h b/arch/loongarch/include/asm/io.h
> index 0130185e0349..7ff4aa72a34a 100644
> --- a/arch/loongarch/include/asm/io.h
> +++ b/arch/loongarch/include/asm/io.h
> @@ -13,6 +13,7 @@
> #include <asm/page.h>
> #include <asm/pgtable-bits.h>
> #include <asm/string.h>
> +#include <linux/mm.h>
>
> extern void __init __iomem *early_ioremap(phys_addr_t phys_addr, unsigned long size);
> extern void __init early_iounmap(void __iomem *addr, unsigned long size);
> --
> 2.25.1
>