Commit 773884e3 authored by Marco Pagani's avatar Marco Pagani Committed by Simona Vetter
Browse files

drm/test: use kunit action wrapper macro in the gem shmem test suite



Replace deferred action function wrappers with equivalent ones defined
using the macro introduced by commit 56778b49 ("kunit: Add a macro to
wrap a deferred action function")

Signed-off-by: default avatarMarco Pagani <marpagan@redhat.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20240723191036.131286-1-marpagan@redhat.com
parent 83b501c1
Loading
Loading
Loading
Loading
+7 −20
Original line number Diff line number Diff line
@@ -23,29 +23,16 @@
#define TEST_BYTE		0xae

/*
 * Wrappers to avoid an explicit type casting when passing action
 * functions to kunit_add_action().
 * Wrappers to avoid cast warnings when passing action functions
 * directly to kunit_add_action().
 */
static void kfree_wrapper(void *ptr)
{
	const void *obj = ptr;

	kfree(obj);
}

static void sg_free_table_wrapper(void *ptr)
{
	struct sg_table *sgt = ptr;
KUNIT_DEFINE_ACTION_WRAPPER(kfree_wrapper, kfree, const void *);

	sg_free_table(sgt);
}

static void drm_gem_shmem_free_wrapper(void *ptr)
{
	struct drm_gem_shmem_object *shmem = ptr;
KUNIT_DEFINE_ACTION_WRAPPER(sg_free_table_wrapper, sg_free_table,
			    struct sg_table *);

	drm_gem_shmem_free(shmem);
}
KUNIT_DEFINE_ACTION_WRAPPER(drm_gem_shmem_free_wrapper, drm_gem_shmem_free,
			    struct drm_gem_shmem_object *);

/*
 * Test creating a shmem GEM object backed by shmem buffer. The test