[PATCH v4 3/6] drm/tests: managed: Remove the waitqueue usage

Michał Winiarski michal.winiarski at intel.com
Fri Jan 5 10:13:21 UTC 2024


DRM managed release (drm_managed_release) is called as part of devres
release (devres_release_all), which is not async.
The release action should have already been executed once
drm_kunit_helper_free_device exits, meaning that there's no need to use
a waitqueue - we can just inspect the "action_done" state directly.

Signed-off-by: Michał Winiarski <michal.winiarski at intel.com>
---
 drivers/gpu/drm/tests/drm_managed_test.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/tests/drm_managed_test.c b/drivers/gpu/drm/tests/drm_managed_test.c
index 659af5abb8014..e4790ae838ba7 100644
--- a/drivers/gpu/drm/tests/drm_managed_test.c
+++ b/drivers/gpu/drm/tests/drm_managed_test.c
@@ -8,12 +8,8 @@
 
 #include <linux/device.h>
 
-/* Ought to be enough for anybody */
-#define TEST_TIMEOUT_MS	100
-
 struct managed_test_priv {
 	bool action_done;
-	wait_queue_head_t action_wq;
 };
 
 static void drm_action(struct drm_device *drm, void *ptr)
@@ -21,7 +17,6 @@ static void drm_action(struct drm_device *drm, void *ptr)
 	struct managed_test_priv *priv = ptr;
 
 	priv->action_done = true;
-	wake_up_interruptible(&priv->action_wq);
 }
 
 static void drm_test_managed_run_action(struct kunit *test)
@@ -33,7 +28,6 @@ static void drm_test_managed_run_action(struct kunit *test)
 
 	priv = kunit_kzalloc(test, sizeof(*priv), GFP_KERNEL);
 	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, priv);
-	init_waitqueue_head(&priv->action_wq);
 
 	dev = drm_kunit_helper_alloc_device(test);
 	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dev);
@@ -50,9 +44,7 @@ static void drm_test_managed_run_action(struct kunit *test)
 	drm_dev_unregister(drm);
 	drm_kunit_helper_free_device(test, dev);
 
-	ret = wait_event_interruptible_timeout(priv->action_wq, priv->action_done,
-					       msecs_to_jiffies(TEST_TIMEOUT_MS));
-	KUNIT_EXPECT_GT(test, ret, 0);
+	KUNIT_EXPECT_TRUE(test, priv->action_done);
 }
 
 static struct kunit_case drm_managed_tests[] = {
-- 
2.43.0



More information about the Intel-xe mailing list