resource, kunit: stop selecting GET_FREE_REGION

RESOURCE_KUNIT_TEST selects GET_FREE_REGION even when no other option
needs it. Remove the selection to follow the dependency rule in
Documentation/dev-tools/kunit/style.rst.

Skip resource_test_region_intersects() when GET_FREE_REGION is disabled.
GET_FREE_REGION has no prompt, so configurations without a production
consumer cannot enable it. Most configurations will therefore skip this
case; this is intentional. The union and intersection tests remain
available.

Since kunit_skip() does not return, the compiler drops the reference to
the unavailable alloc_free_mem_region(), as in the CONFIG_OF_ADDRESS
check in drivers/of/of_test.c.

Link: https://lore.kernel.org/20260926002651.87267-1-kmehltretter@gmail.com
Fixes: 99185c10d5 ("resource, kunit: add test case for region_intersects()")
Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Bradley Morgan <brads@mainlining.org>
Tested-by: Bradley Morgan <brads@mainlining.org> # Power10
Assisted-by: LLM
Cc: Ying Huang <huang.ying.caritas@gmail.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Brendan Higgins <brendan.higgins@linux.dev>
Cc: David Gow <david@davidgow.net>
Cc: Rae Moar <raemoar63@gmail.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
This commit is contained in:
Karl Mehltretter 2026-09-26 02:26:51 +02:00 committed by Andrew Morton
parent 67b509c23f
commit 7c3f4d699f
2 changed files with 3 additions and 1 deletions

View File

@ -225,6 +225,9 @@ static void resource_test_region_intersects(struct kunit *test)
struct resource *parent; struct resource *parent;
resource_size_t start; resource_size_t start;
if (!IS_ENABLED(CONFIG_GET_FREE_REGION))
kunit_skip(test, "CONFIG_GET_FREE_REGION is disabled");
/* Find an iomem_resource hole to hold test resources */ /* Find an iomem_resource hole to hold test resources */
parent = alloc_free_mem_region(&iomem_resource, RES_TEST_TOTAL_SIZE, SZ_1M, parent = alloc_free_mem_region(&iomem_resource, RES_TEST_TOTAL_SIZE, SZ_1M,
"test resources"); "test resources");

View File

@ -2776,7 +2776,6 @@ config RESOURCE_KUNIT_TEST
tristate "KUnit test for resource API" if !KUNIT_ALL_TESTS tristate "KUnit test for resource API" if !KUNIT_ALL_TESTS
depends on KUNIT depends on KUNIT
default KUNIT_ALL_TESTS default KUNIT_ALL_TESTS
select GET_FREE_REGION
help help
This builds the resource API unit test. This builds the resource API unit test.
Tests the logic of API provided by resource.c and ioport.h. Tests the logic of API provided by resource.c and ioport.h.