drivers/gpu/drm/xe/tests/xe_test.h

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/xe/tests/xe_test.h

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/xe/tests/xe_test.h
Extension
.h
Size
1524 bytes
Lines
64
Domain
Driver Families
Bucket
drivers/gpu
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct xe_test_priv {
	enum xe_test_priv_id id;
};

#define XE_TEST_DECLARE(x) x
#define XE_TEST_ONLY(x) unlikely(x)

/**
 * xe_cur_kunit_priv - Obtain the struct xe_test_priv pointed to by
 * current->kunit->priv if it exists and is embedded in the expected subclass.
 * @id: Id of the expected subclass.
 *
 * Return: NULL if the process is not a kunit test, and NULL if the
 * current kunit->priv pointer is not pointing to an object of the expected
 * subclass. A pointer to the embedded struct xe_test_priv otherwise.
 */
static inline struct xe_test_priv *
xe_cur_kunit_priv(enum xe_test_priv_id id)
{
	struct xe_test_priv *priv;

	if (!kunit_get_current_test())
		return NULL;

	priv = kunit_get_current_test()->priv;
	return priv->id == id ? priv : NULL;
}

#else /* if IS_ENABLED(CONFIG_DRM_XE_KUNIT_TEST) */

#define XE_TEST_DECLARE(x)
#define XE_TEST_ONLY(x) 0
#define xe_cur_kunit_priv(_id) NULL

#endif
#endif

Annotation

Implementation Notes