[PATCH RFC 1/5] mm: selftests: Inline check_bytes() function into caller
From: Ackerley Tng via B4 Relay
Date: Mon May 18 2026 - 14:23:20 EST
From: Ackerley Tng <ackerleytng@xxxxxxxxxx>
Inline the check_bytes() function to prepare for using the kselftest
harness, where TH_LOG() relies on the variable _metadata being present in
the caller.
Instead of passing _metadata to a helper function like check_bytes(), call
TH_LOG() directly.
Signed-off-by: Ackerley Tng <ackerleytng@xxxxxxxxxx>
---
tools/testing/selftests/mm/hugepage-mmap.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/tools/testing/selftests/mm/hugepage-mmap.c b/tools/testing/selftests/mm/hugepage-mmap.c
index d543419de0407..8c246070572f9 100644
--- a/tools/testing/selftests/mm/hugepage-mmap.c
+++ b/tools/testing/selftests/mm/hugepage-mmap.c
@@ -20,11 +20,6 @@
#define LENGTH (256UL*1024*1024)
#define PROTECTION (PROT_READ | PROT_WRITE)
-static void check_bytes(char *addr)
-{
- ksft_print_msg("First hex is %x\n", *((unsigned int *)addr));
-}
-
static void write_bytes(char *addr)
{
unsigned long i;
@@ -37,7 +32,7 @@ static int read_bytes(char *addr)
{
unsigned long i;
- check_bytes(addr);
+ ksft_print_msg("First hex is %x\n", *((unsigned int *)addr));
for (i = 0; i < LENGTH; i++)
if (*(addr + i) != (char)i) {
ksft_print_msg("Error: Mismatch at %lu\n", i);
@@ -65,7 +60,7 @@ int main(void)
}
ksft_print_msg("Returned address is %p\n", addr);
- check_bytes(addr);
+ ksft_print_msg("First hex is %x\n", *((unsigned int *)addr));
write_bytes(addr);
ret = read_bytes(addr);
--
2.54.0.563.g4f69b47b94-goog