drm_kunit_h...c_drm_device(9)
β¨ NAME β¨
Okay bestie, this page is from the Kernel API Manual, and it's all about drm_kunit_helper_alloc_drm_device β it allocates a mock DRM device for KUnit tests π
. Yes, this is that drm_kunit_h...c_drm_device(9) cutie. She's giving test-helper main character energy π.
π¦ SYNOPSIS π¦
drm_kunit_helper_alloc_drm_device (_test , _dev , _type , _member ,
_feat );
π ARGUMENTS π
_testβ The test context object, aka the vibe holder for this test π«Ά._devβ The parent device object._typeβ the type of the struct which containsstruct drm_device._memberβ the name of thedrm_devicewithin_type._featβ Mocked DRM device driver features β¨.
πΈ DESCRIPTION πΈ
So this function creates a struct drm_driver, and then it will create a struct drm_device from _dev and that driver. Lowkey iconic setup behavior.
_dev should be allocated using drm_kunit_helper_alloc_device. No cap, that's the required move β not a suggestion, bestie π.
The driver is tied to the _test context and will get cleaned at the end of the test. The drm_device is allocated through devm_drm_dev_alloc and will thus be freed through a device-managed resource. So yeah, cleanup is handled, and that's honestly slay π§.
β RETURN β
A pointer to the new drm_device, or an ERR_PTR otherwise. That's it β either the cute new device pointer, or the error-pointer plot twist π.
π SEE ALSO π
- Kernel file
./include/drm/drm_kunit_helpers.h drm_kunit_helper_alloc_drm_device_with_driver(9)
Okay that's the whole page, bestie π β this one comes from ./include/drm, dated October 2026, and the page title is drm_kunit_h...c_drm_device(9). Go forth and test your DRM device allocation with main character confidence ππ.
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms