summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichał Winiarski <michal.winiarski@intel.com>2024-01-15 18:13:49 +0100
committerMaxime Ripard <mripard@kernel.org>2024-01-17 10:38:46 +0100
commita1c73a3b79402d1e4c5d3ced09f555aad1565fde (patch)
treeeb365d63160308161c72fa829362c24b317e3610
parentdd0ce02f9897d465386f51078038784d22fd5217 (diff)
downloadlinux-stable-a1c73a3b79402d1e4c5d3ced09f555aad1565fde.tar.gz
linux-stable-a1c73a3b79402d1e4c5d3ced09f555aad1565fde.tar.bz2
linux-stable-a1c73a3b79402d1e4c5d3ced09f555aad1565fde.zip
drm/tests: managed: Add comments about test intent
Add comments explaining the intention behind the test and certain implementation details related to device lifetime. Signed-off-by: Michał Winiarski <michal.winiarski@intel.com> Signed-off-by: Maxime Ripard <mripard@kernel.org> Link: https://patchwork.freedesktop.org/patch/msgid/20240115171351.504264-4-michal.winiarski@intel.com
-rw-r--r--drivers/gpu/drm/tests/drm_managed_test.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/gpu/drm/tests/drm_managed_test.c b/drivers/gpu/drm/tests/drm_managed_test.c
index f85dada4de0a..b5cf46d9f5cf 100644
--- a/drivers/gpu/drm/tests/drm_managed_test.c
+++ b/drivers/gpu/drm/tests/drm_managed_test.c
@@ -24,6 +24,10 @@ static void drm_action(struct drm_device *drm, void *ptr)
wake_up_interruptible(&priv->action_wq);
}
+/*
+ * The test verifies that the release action is called automatically when the
+ * device is released.
+ */
static void drm_test_managed_run_action(struct kunit *test)
{
struct managed_test_priv *priv;
@@ -38,6 +42,11 @@ static void drm_test_managed_run_action(struct kunit *test)
dev = drm_kunit_helper_alloc_device(test);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dev);
+ /*
+ * DRM device can't be embedded in priv, since priv->action_done needs
+ * to remain allocated beyond both parent device and drm_device
+ * lifetime.
+ */
drm = __drm_kunit_helper_alloc_drm_device(test, dev, sizeof(*drm), 0, DRIVER_MODESET);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, drm);