diff mbox series

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

Message ID 20240725014157.17707-1-richard.weiyang@gmail.com (mailing list archive)
State New
Headers show
Series [1/5] memblock test: fix implicit declaration of function 'virt_to_phys' | expand

Commit Message

Wei Yang July 25, 2024, 1:41 a.m. UTC
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@gmail.com>
---
 tools/testing/memblock/linux/kernel.h | 2 ++
 1 file changed, 2 insertions(+)

Comments

Mike Rapoport July 28, 2024, 5:56 a.m. UTC | #1
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@gmail.com>
> ---
>  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
>
diff mbox series

Patch

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)
+
 #endif