diff options
| author | Danilo Krummrich <[email protected]> | 2025-04-10 23:55:20 +0000 |
|---|---|---|
| committer | Danilo Krummrich <[email protected]> | 2025-04-24 11:50:03 +0000 |
| commit | 57493a145552fe8a9a926f25b14c324c441ca358 (patch) | |
| tree | afcadde0eeae7d1160b8558ed5371c021b0339cb /rust/helpers/helpers.c | |
| parent | samples: rust: convert PCI rust sample driver to use try_access_with() (diff) | |
| download | kernel-57493a145552fe8a9a926f25b14c324c441ca358.tar.gz kernel-57493a145552fe8a9a926f25b14c324c441ca358.zip | |
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 <[email protected]>
Reviewed-by: Alyssa Rosenzweig <[email protected]>
Reviewed-by: Lyude Paul <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Danilo Krummrich <[email protected]>
Diffstat (limited to 'rust/helpers/helpers.c')
0 files changed, 0 insertions, 0 deletions
