devm_drm_dev_alloc(9)
β¨ devm_drm_dev_alloc β¨
okay bestie, so this is a page from the Kernel API Manual, and it's about devm_drm_dev_alloc β the resource-managed way to spin up a &drm_device instance π
specifically, it's a resource managed allocation of a &drm_device instance, and it's lowkey iconic for the lazy-in-a-good-way driver dev.
π SYNOPSIS π
devm_drm_dev_alloc (parent , driver , type , member );
πΈ ARGUMENTS πΈ
parentβ the parent device object π«Άdriverβ the DRM drivertypeβ the type of thestructwhich containsstruct drm_devicememberβ the name of thedrm_devicewithintype
π¦ DESCRIPTION π¦
So what this does: it allocates and initializes a new DRM device π but heads up β no device registration is done. none. zero. nope π
For that you gotta call drm_dev_register to advertise the device to user space and register it with the other core subsystems. And the way to do it right? Do it last in the device initialization sequence, so userspace can't get its hands on an inconsistent state. that's the vibe check π₯
The initial ref-count of the object is 1. Use drm_dev_get and drm_dev_put to take and drop further ref-counts, bestie β¨
It is recommended that drivers embed struct drm_device into their own device structure. do it. it's giving good design π
π Note bestie: this manages the lifetime of the resultingdrm_deviceautomatically using devres. The DRM device initialized with this function is automatically put on driver detach usingdrm_dev_put. so you literally don't have to worry about it β no cap ππ«Ά
β RETURN β
Pointer to new DRM device, or ERR_PTR on failure. that's it, that's the return π
π SEE ALSO π
- Kernel file
./include/drm/drm_drv.henumdrm_driver_feature(9) struct drm_driver(9)drm_dev_is_unplugged(9)drm_core_check_all_features(9)drm_core_check_feature(9)drm_drv_uses_atomic_modeset(9)
β¨ and that's the whole page! β¨ this lil beauty lives in ./include/drm, it's dated October 2026, and it's brought to you by the Kernel API Manual β go forth and allocate responsibly, bestie πππ¦πΈπ
π«Άππβπ§π
π¦ 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