[PATCH 3/4] rust: drm: gem: s/into_gem_obj()/as_gem_obj()/

Danilo Krummrich dakr at kernel.org
Mon May 12 12:22:59 UTC 2025


On Thu, May 01, 2025 at 02:33:18PM -0400, Lyude Paul wrote:
> There's a few changes here:
> * The rename, of course (this should also let us drop the clippy annotation
>   here)
> * Return *mut bindings::drm_gem_object instead of
>   &Opaque<bindings::drm_gem_object> - the latter doesn't really have any
>   benefit and just results in conversion from the rust type to the C type
>   having to be more verbose than necessary.
> 
> Signed-off-by: Lyude Paul <lyude at redhat.com>
> ---
>  rust/kernel/drm/gem/mod.rs | 21 +++++++--------------
>  1 file changed, 7 insertions(+), 14 deletions(-)
> 
> diff --git a/rust/kernel/drm/gem/mod.rs b/rust/kernel/drm/gem/mod.rs
> index f70531889c21f..55b2f1d056c39 100644
> --- a/rust/kernel/drm/gem/mod.rs
> +++ b/rust/kernel/drm/gem/mod.rs
> @@ -42,8 +42,7 @@ pub trait IntoGEMObject: Sized + super::private::Sealed {
>  
>      /// Returns a reference to the raw `drm_gem_object` structure, which must be valid as long as
>      /// this owning object is valid.
> -    #[allow(clippy::wrong_self_convention)]
> -    fn into_gem_obj(&self) -> &Opaque<bindings::drm_gem_object>;
> +    fn as_gem_obj(&self) -> *mut bindings::drm_gem_object;

Maybe just as_raw()? Either way,

	Reviewed-by: Danilo Krummrich <dakr at kernel.org>


More information about the dri-devel mailing list