Skip to content

drm/xe/test: Basic type-check of the current test private struct

Thomas Hellström requested to merge thomash/kernel:xe_test_update into xe

Our kunit test allows to pass a pointer to a test-specific struct in current->kunit->priv. However, since the code that looks at this pointer might be called from various different kunit tests with different versions of the struct pointed to, avoid false assumptions by having these structs always be subclasses of struct xe_test_priv with the specific subclass type given in the id field of the base class.

The code that wants to inspect the current->kunit->priv pointer can now use xe_cur_kunit_priv(id) with the id being the registered id of the subclass the code expects. If the id doesn't match, NULL is returned indicating a test the code isn't adapted for.

This might still fail if the test originates from outside our driver, though.

Signed-off-by: Thomas Hellström thomas.hellstrom@linux.intel.com

Merge request reports

Loading