Commit a1c73a3b authored by Michał Winiarski's avatar Michał Winiarski Committed by Maxime Ripard

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: default avatarMichał Winiarski <michal.winiarski@intel.com>
Signed-off-by: default avatarMaxime Ripard <mripard@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20240115171351.504264-4-michal.winiarski@intel.com
parent dd0ce02f
...@@ -24,6 +24,10 @@ static void drm_action(struct drm_device *drm, void *ptr) ...@@ -24,6 +24,10 @@ static void drm_action(struct drm_device *drm, void *ptr)
wake_up_interruptible(&priv->action_wq); 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) static void drm_test_managed_run_action(struct kunit *test)
{ {
struct managed_test_priv *priv; struct managed_test_priv *priv;
...@@ -38,6 +42,11 @@ static void drm_test_managed_run_action(struct kunit *test) ...@@ -38,6 +42,11 @@ static void drm_test_managed_run_action(struct kunit *test)
dev = drm_kunit_helper_alloc_device(test); dev = drm_kunit_helper_alloc_device(test);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dev); 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); drm = __drm_kunit_helper_alloc_drm_device(test, dev, sizeof(*drm), 0, DRIVER_MODESET);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, drm); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, drm);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment