[PATCH] resource, kunit: add sparsemem dependency

From: Arnd Bergmann
Date: Mon Sep 09 2024 - 09:10:21 EST


The testcase now selects CONFIG_GET_FREE_REGION, but that
is only available for sparsemem configurations:

WARNING: unmet direct dependencies detected for GET_FREE_REGION
Depends on [n]: SPARSEMEM [=n]
Selected by [m]:
- RESOURCE_KUNIT_TEST [=m] && RUNTIME_TESTING_MENU [=y] && KUNIT [=y]
In file included from include/linux/ioport.h:15,
from kernel/resource.c:15:
kernel/resource.c: In function 'gfr_start':
include/linux/mm.h:101:35: error: 'MAX_PHYSMEM_BITS' undeclared (first use in this function)
101 | # define PHYSMEM_END ((1ULL << MAX_PHYSMEM_BITS) - 1)
kernel/resource.c:1874:57: note: in expansion of macro 'PHYSMEM_END'
1874 | end = min_t(resource_size_t, base->end, PHYSMEM_END);
| ^~~~~~~~~~~

It may be better to extend this to non-sparsemem, but a Kconfig
dependency is the easiest way to address the build failure at the
moment.

Fixes: e2941fe697c8 ("resource, kunit: add test case for region_intersects()")
Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>

diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index b986050fc7e0..4c081a28fe96 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -2632,6 +2632,7 @@ config HASH_KUNIT_TEST
config RESOURCE_KUNIT_TEST
tristate "KUnit test for resource API" if !KUNIT_ALL_TESTS
depends on KUNIT
+ depends on SPARSEMEM
default KUNIT_ALL_TESTS
select GET_FREE_REGION
help