[PATCH v15 11/19] drm/etnaviv: Add etnaviv_gem_obj_remove() helper
Lucas Stach
l.stach at pengutronix.de
Tue Oct 1 14:21:53 UTC 2024
Am Sonntag, dem 08.09.2024 um 17:43 +0800 schrieb Sui Jingfeng:
> Which is corresonding to the etnaviv_gem_obj_add()
>
While symmetry is nice, it's still not really symmetric, as this
function isn't exported into the PRIME parts of the driver like
etnaviv_gem_obj_add(). Given that I don't really see how this patch
improves code legibility.
Regards,
Lucas
> Signed-off-by: Sui Jingfeng <sui.jingfeng at linux.dev>
> ---
> drivers/gpu/drm/etnaviv/etnaviv_gem.c | 17 +++++++++++++----
> 1 file changed, 13 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem.c b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
> index 39cfece67b90..3732288ff530 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_gem.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
> @@ -19,6 +19,8 @@
> static struct lock_class_key etnaviv_shm_lock_class;
> static struct lock_class_key etnaviv_userptr_lock_class;
>
> +static void etnaviv_gem_obj_remove(struct drm_gem_object *obj);
> +
> static void etnaviv_gem_scatter_map(struct etnaviv_gem_object *etnaviv_obj)
> {
> struct drm_device *dev = etnaviv_obj->base.dev;
> @@ -555,15 +557,12 @@ void etnaviv_gem_free_object(struct drm_gem_object *obj)
> {
> struct drm_device *drm = obj->dev;
> struct etnaviv_gem_object *etnaviv_obj = to_etnaviv_bo(obj);
> - struct etnaviv_drm_private *priv = obj->dev->dev_private;
> struct etnaviv_vram_mapping *mapping, *tmp;
>
> /* object should not be active */
> drm_WARN_ON(drm, is_active(etnaviv_obj));
>
> - mutex_lock(&priv->gem_lock);
> - list_del(&etnaviv_obj->gem_node);
> - mutex_unlock(&priv->gem_lock);
> + etnaviv_gem_obj_remove(obj);
>
> list_for_each_entry_safe(mapping, tmp, &etnaviv_obj->vram_list,
> obj_node) {
> @@ -595,6 +594,16 @@ void etnaviv_gem_obj_add(struct drm_device *dev, struct drm_gem_object *obj)
> mutex_unlock(&priv->gem_lock);
> }
>
> +static void etnaviv_gem_obj_remove(struct drm_gem_object *obj)
> +{
> + struct etnaviv_drm_private *priv = to_etnaviv_priv(obj->dev);
> + struct etnaviv_gem_object *etnaviv_obj = to_etnaviv_bo(obj);
> +
> + mutex_lock(&priv->gem_lock);
> + list_del(&etnaviv_obj->gem_node);
> + mutex_unlock(&priv->gem_lock);
> +}
> +
> static const struct vm_operations_struct vm_ops = {
> .fault = etnaviv_gem_fault,
> .open = drm_gem_vm_open,
More information about the dri-devel
mailing list