On Mon, 13 Jul 2026 11:45:17 +0200, Bartosz Golaszewski <[email protected]> said: > On Sun, 12 Jul 2026 18:59:04 +0200, Danilo Krummrich <[email protected]> said: >> On Fri Jul 10, 2026 at 3:51 PM CEST, Bartosz Golaszewski wrote: >> >> static struct kunit_case swnode_test_cases[] = { >> diff --git a/drivers/gpio/gpiolib-kunit.c b/drivers/gpio/gpiolib-kunit.c >> index ad961cf97aee..7798f8a8e602 100644 >> --- a/drivers/gpio/gpiolib-kunit.c >> +++ b/drivers/gpio/gpiolib-kunit.c >> @@ -449,6 +449,9 @@ static void >> gpio_swnode_probe_defer_on_unregistered(struct kunit *test) >> >> pdata = dev_get_platdata(&cons->dev); >> KUNIT_ASSERT_EQ(test, pdata->gpio_err, 0); >> + >> + /* Tear down the consumer before the provider to free the GPIO. */ >> + kunit_platform_device_unregister(test, cons); >> } >> >> static int gpio_swnode_probe_order_test_init(struct kunit *test) >> @@ -614,9 +617,17 @@ static struct kunit_case >> gpio_unbind_with_consumers_tests[] = { >> { } >> }; >> >> +static int gpio_unbind_test_init(struct kunit *test) >> +{ >> + device_link_wait_removal(); > > Interestingly I noticed this in the GPIO test cases but not here... > > I also think that we should call device_link_wait_removal() *before* and > *after* these cases to not affect other test suites - as pointed out by > sashiko too. >
Huh, that won't work because suite->exit() runs *before* kunit_cleanup(). Isn't it wrong? We do suite->init(), then schedule actions inside the test, it would make sense to then first call the release callbacks for resources and only after that call suite->exit()? Anyway, that's material for another series. Bart

