[PATCH] drm/tests: Alloc drm_device on drm_exec tests

Maxime Ripard mripard at redhat.com
Mon Jul 31 12:25:32 UTC 2023


Hi,

On Fri, Jul 28, 2023 at 02:43:14PM -0300, Arthur Grillo Queiroz Cabral wrote:
> >>  drivers/gpu/drm/tests/drm_exec_test.c | 36 +++++++++++++++++++++------
> >>  1 file changed, 29 insertions(+), 7 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/tests/drm_exec_test.c b/drivers/gpu/drm/tests/drm_exec_test.c
> >> index 727ac267682e..df31f89a7945 100644
> >> --- a/drivers/gpu/drm/tests/drm_exec_test.c
> >> +++ b/drivers/gpu/drm/tests/drm_exec_test.c
> >> @@ -12,11 +12,31 @@
> >>  
> >>  #include <drm/drm_exec.h>
> >>  #include <drm/drm_device.h>
> >> +#include <drm/drm_drv.h>
> >>  #include <drm/drm_gem.h>
> >> +#include <drm/drm_kunit_helpers.h>
> >>  
> >>  #include "../lib/drm_random.h"
> >>  
> >> -static struct drm_device dev;
> >> +static struct device *dev;
> >> +static struct drm_device *drm;
> >> +
> >> +static int test_init(struct kunit *test)
> >> +{
> >> +	dev = drm_kunit_helper_alloc_device(test);
> >> +	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dev);
> >> +
> >> +	drm = __drm_kunit_helper_alloc_drm_device(test, dev, sizeof(*drm), 0,
> >> +						  DRIVER_MODESET);
> >> +	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, drm);
> >> +
> >> +	return 0;
> >> +}
> >> +
> >> +static void test_exit(struct kunit *test)
> >> +{
> >> +	drm_kunit_helper_free_device(test, dev);
> >> +}

Also, I just pushed changes that make the call to
drm_kunit_helper_free_device unnecessary.

Maxime
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20230731/121c5187/attachment-0001.sig>


More information about the dri-devel mailing list