Re: [PATCH 1/5] memblock test: fix implicit declaration of function 'virt_to_phys'

From: Mike Rapoport
Date: Sun Jul 28 2024 - 01:56:53 EST


On Thu, Jul 25, 2024 at 01:41:53AM +0000, Wei Yang wrote:
> Commit 94ff46de4a73 ("memblock: Move late alloc warning down to phys
> alloc") introduce the usage of virt_to_phys(), which is not defined in
> memblock tests.
>
> Define it in kernel.h to fix the build error.
>
> Signed-off-by: Wei Yang <richard.weiyang@xxxxxxxxx>
> ---
> tools/testing/memblock/linux/kernel.h | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/tools/testing/memblock/linux/kernel.h b/tools/testing/memblock/linux/kernel.h
> index d2f148bd8902..ca56f36ef296 100644
> --- a/tools/testing/memblock/linux/kernel.h
> +++ b/tools/testing/memblock/linux/kernel.h
> @@ -9,4 +9,6 @@
> #include <linux/linkage.h>
> #include <linux/kconfig.h>
>
> +#define virt_to_phys(p) ((unsigned long)p)
> +

There's already phys_to_virt() in tools/include/linux/mm.h.
It'd be better to put this one next to it.

> #endif
> --
> 2.34.1
>

--
Sincerely yours,
Mike.