aboutsummaryrefslogtreecommitdiffstats
path: root/rust/helpers/pci.c
diff options
context:
space:
mode:
authorLyude Paul <[email protected]>2025-05-13 22:09:55 +0000
committerDanilo Krummrich <[email protected]>2025-05-13 22:26:16 +0000
commit36b1ccbfa0c2f45fae3e07bf66e40d7fd6704874 (patch)
treeb489cf0e27a46cfff5209e6245d2c893a57ce426 /rust/helpers/pci.c
parentrust: drm: gem: Use NonNull for Object::dev (diff)
downloadkernel-36b1ccbfa0c2f45fae3e07bf66e40d7fd6704874.tar.gz
kernel-36b1ccbfa0c2f45fae3e07bf66e40d7fd6704874.zip
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 <[email protected]> Reviewed-by: Daniel Almeida <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Danilo Krummrich <[email protected]>
Diffstat (limited to 'rust/helpers/pci.c')
0 files changed, 0 insertions, 0 deletions