diff mbox series

[11/36] drm/gem: add drm_object_put helper

Message ID 20200507150822.114464-12-emil.l.velikov@gmail.com (mailing list archive)
State New, archived
Headers show
Series drm: Fareless gem_free_object | expand

Commit Message

Emil Velikov May 7, 2020, 3:07 p.m. UTC
From: Emil Velikov <emil.velikov@collabora.com>

Spelling out _unlocked for each and every driver is a annoying.
Especially if we consider how many drivers, do not know (or need to)
about the horror stories involving struct_mutex.

Add helper, which will allow us to transition the drivers one by one,
dropping the suffix.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
---
 include/drm/drm_gem.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Jani Nikula May 8, 2020, 6:33 a.m. UTC | #1
On Thu, 07 May 2020, Emil Velikov <emil.l.velikov@gmail.com> wrote:
> From: Emil Velikov <emil.velikov@collabora.com>
>
> Spelling out _unlocked for each and every driver is a annoying.
> Especially if we consider how many drivers, do not know (or need to)
> about the horror stories involving struct_mutex.
>
> Add helper, which will allow us to transition the drivers one by one,
> dropping the suffix.
>
> Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
> ---
>  include/drm/drm_gem.h | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/include/drm/drm_gem.h b/include/drm/drm_gem.h
> index 0f22f3320dcb..70c0059ee72b 100644
> --- a/include/drm/drm_gem.h
> +++ b/include/drm/drm_gem.h
> @@ -364,18 +364,20 @@ static inline void drm_gem_object_get(struct drm_gem_object *obj)
>  }
>  
>  /**
> - * drm_gem_object_put_unlocked - drop a GEM buffer object reference
> + * drm_gem_object_put- drop a GEM buffer object reference
                        ^

Missing space.

>   * @obj: GEM buffer object
>   *
>   * This releases a reference to @obj. Callers must not hold the
>   * &drm_device.struct_mutex lock when calling this function.
>   */
>  static inline void
> -drm_gem_object_put_unlocked(struct drm_gem_object *obj)
> +drm_gem_object_put(struct drm_gem_object *obj)
>  {
>  	kref_put(&obj->refcount, drm_gem_object_free);
>  }
>  
> +#define drm_gem_object_put_unlocked drm_gem_object_put
> +
>  void drm_gem_object_put_locked(struct drm_gem_object *obj);
>  
>  int drm_gem_handle_create(struct drm_file *file_priv,
Emil Velikov May 8, 2020, 10:16 a.m. UTC | #2
On Fri, 8 May 2020 at 07:33, Jani Nikula <jani.nikula@linux.intel.com> wrote:
>
> On Thu, 07 May 2020, Emil Velikov <emil.l.velikov@gmail.com> wrote:
> > From: Emil Velikov <emil.velikov@collabora.com>
> >
> > Spelling out _unlocked for each and every driver is a annoying.
> > Especially if we consider how many drivers, do not know (or need to)
> > about the horror stories involving struct_mutex.
> >
> > Add helper, which will allow us to transition the drivers one by one,
> > dropping the suffix.
> >
> > Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
> > ---
> >  include/drm/drm_gem.h | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/include/drm/drm_gem.h b/include/drm/drm_gem.h
> > index 0f22f3320dcb..70c0059ee72b 100644
> > --- a/include/drm/drm_gem.h
> > +++ b/include/drm/drm_gem.h
> > @@ -364,18 +364,20 @@ static inline void drm_gem_object_get(struct drm_gem_object *obj)
> >  }
> >
> >  /**
> > - * drm_gem_object_put_unlocked - drop a GEM buffer object reference
> > + * drm_gem_object_put- drop a GEM buffer object reference
>                         ^
>
> Missing space.
>
Thanks fixed.

-Emil
diff mbox series

Patch

diff --git a/include/drm/drm_gem.h b/include/drm/drm_gem.h
index 0f22f3320dcb..70c0059ee72b 100644
--- a/include/drm/drm_gem.h
+++ b/include/drm/drm_gem.h
@@ -364,18 +364,20 @@  static inline void drm_gem_object_get(struct drm_gem_object *obj)
 }
 
 /**
- * drm_gem_object_put_unlocked - drop a GEM buffer object reference
+ * drm_gem_object_put- drop a GEM buffer object reference
  * @obj: GEM buffer object
  *
  * This releases a reference to @obj. Callers must not hold the
  * &drm_device.struct_mutex lock when calling this function.
  */
 static inline void
-drm_gem_object_put_unlocked(struct drm_gem_object *obj)
+drm_gem_object_put(struct drm_gem_object *obj)
 {
 	kref_put(&obj->refcount, drm_gem_object_free);
 }
 
+#define drm_gem_object_put_unlocked drm_gem_object_put
+
 void drm_gem_object_put_locked(struct drm_gem_object *obj);
 
 int drm_gem_handle_create(struct drm_file *file_priv,