diff options
author | Danilo Krummrich <dakr@kernel.org> | 2025-04-11 01:55:20 +0200 |
---|---|---|
committer | Danilo Krummrich <dakr@kernel.org> | 2025-04-24 13:50:03 +0200 |
commit | 57493a145552fe8a9a926f25b14c324c441ca358 (patch) | |
tree | afcadde0eeae7d1160b8558ed5371c021b0339cb /rust/helpers/helpers.c | |
parent | 0c848b3adb45acc1722f94333e2a97bf1720e431 (diff) |
drm: drv: implement __drm_dev_alloc()
In the Rust DRM device abstraction we need to allocate a struct
drm_device.
Currently, there are two options, the deprecated drm_dev_alloc() (which
does not support subclassing) and devm_drm_dev_alloc(). The latter
supports subclassing, but also manages the initial reference through
devres for the parent device.
In Rust we want to conform with the subclassing pattern, but do not want
to get the initial reference managed for us, since Rust has its own,
idiomatic ways to properly deal with it.
There are two options to achieve this.
1) Allocate the memory ourselves with a KBox.
2) Implement __drm_dev_alloc(), which supports subclassing, but is
unmanged.
While (1) would be possible, it would be cumbersome, since it would
require exporting drm_dev_init() and drmm_add_final_kfree().
Hence, go with option (2) and implement __drm_dev_alloc().
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Link: https://lore.kernel.org/r/20250410235546.43736-2-dakr@kernel.org
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Diffstat (limited to 'rust/helpers/helpers.c')
0 files changed, 0 insertions, 0 deletions