diff options
author | Lyude Paul <lyude@redhat.com> | 2025-05-14 01:09:55 +0300 |
---|---|---|
committer | Danilo Krummrich <dakr@kernel.org> | 2025-05-14 01:26:16 +0300 |
commit | 36b1ccbfa0c2f45fae3e07bf66e40d7fd6704874 (patch) | |
tree | b489cf0e27a46cfff5209e6245d2c893a57ce426 /scripts/lib/kdoc/kdoc_parser.py | |
parent | 6ee48aee8c705717051109ff889f2a1d4f409ea9 (diff) | |
download | linux-36b1ccbfa0c2f45fae3e07bf66e40d7fd6704874.tar.xz |
rust: drm: gem: Refactor IntoGEMObject::from_gem_obj() to as_ref()
There's a few issues with this function, mainly:
* This function -probably- should have been unsafe from the start. Pointers
are not always necessarily valid, but you want a function that does
field-projection for a pointer that can travel outside of the original
struct to be unsafe, at least if I understand properly.
* *mut Self is not terribly useful in this context, the majority of uses of
from_gem_obj() grab a *mut Self and then immediately convert it into a
&'a Self. It also goes against the ffi conventions we've set in the rest
of the kernel thus far.
* from_gem_obj() also doesn't follow the naming conventions in the rest of
the DRM bindings at the moment, as_ref() would be a better name.
So, let's:
* Make from_gem_obj() unsafe
* Convert it to return &'a Self
* Rename it to as_ref()
* Update all call locations
Signed-off-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com>
Link: https://lore.kernel.org/r/20250513221046.903358-3-lyude@redhat.com
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Diffstat (limited to 'scripts/lib/kdoc/kdoc_parser.py')
0 files changed, 0 insertions, 0 deletions