[PATCH] RISC-V: selftests: cbo: Use exported __cpu_to_le32() with uapi header

woodrow.shen at sifive.com woodrow.shen at sifive.com
Thu Mar 21 04:52:50 PDT 2024


From: Hsieh-Tseng Shen <woodrow.shen at sifive.com>

cpu_to_le32 is not defined in uapi headers, and it could cause an error
of impossible constraint in 'asm' during compilation. However,
the reason is due to undefined reference to cpu_to_le32.
__cpu_to_le32() defined from byteorder.h should be used instead.

Signed-off-by: Hsieh-Tseng Shen <woodrow.shen at sifive.com>
---
 tools/testing/selftests/riscv/hwprobe/cbo.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/riscv/hwprobe/cbo.c b/tools/testing/selftests/riscv/hwprobe/cbo.c
index c537d52fafc5..b2dd18b3e360 100644
--- a/tools/testing/selftests/riscv/hwprobe/cbo.c
+++ b/tools/testing/selftests/riscv/hwprobe/cbo.c
@@ -15,11 +15,12 @@
 #include <linux/compiler.h>
 #include <linux/kernel.h>
 #include <asm/ucontext.h>
+#include <asm/byteorder.h>
 
 #include "hwprobe.h"
 #include "../../kselftest.h"
 
-#define MK_CBO(fn) cpu_to_le32((fn) << 20 | 10 << 15 | 2 << 12 | 0 << 7 | 15)
+#define MK_CBO(fn) __cpu_to_le32((fn) << 20 | 10 << 15 | 2 << 12 | 0 << 7 | 15)
 
 static char mem[4096] __aligned(4096) = { [0 ... 4095] = 0xa5 };
 
-- 
2.34.1




More information about the linux-riscv mailing list