diff options
author | Maarten Lankhorst | 2020-08-25 11:00:02 +0200 |
---|---|---|
committer | Maarten Lankhorst | 2020-08-25 11:00:02 +0200 |
commit | 2d9ad4cfaf4d32a64a4ed556e5bcab9121215026 (patch) | |
tree | 3572e6cd05effa4e2943cee817defb2b9a72afd1 /include/drm/drm_gem.h | |
parent | 77ef38574beb3e0b414db48e9c0f04633df68ba6 (diff) | |
parent | d012a7190fc1fd72ed48911e77ca97ba4521bccd (diff) |
Merge tag 'v5.9-rc2' into drm-misc-fixes
Backmerge requested by Tomi for a fix to omap inconsistent
locking state issue, and because we need at least v5.9-rc2 now.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Diffstat (limited to 'include/drm/drm_gem.h')
-rw-r--r-- | include/drm/drm_gem.h | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/include/drm/drm_gem.h b/include/drm/drm_gem.h index 0b375069cd48..337a48321705 100644 --- a/include/drm/drm_gem.h +++ b/include/drm/drm_gem.h @@ -143,7 +143,7 @@ struct drm_gem_object_funcs { /** * @vunmap: * - * Releases the the address previously returned by @vmap. Used by the + * Releases the address previously returned by @vmap. Used by the * drm_gem_dmabuf_vunmap() helper. * * This callback is optional. @@ -157,7 +157,7 @@ struct drm_gem_object_funcs { * * This callback is optional. * - * The callback is used by by both drm_gem_mmap_obj() and + * The callback is used by both drm_gem_mmap_obj() and * drm_gem_prime_mmap(). When @mmap is present @vm_ops is not * used, the @mmap callback must set vma->vm_ops instead. */ @@ -187,8 +187,8 @@ struct drm_gem_object { * * Reference count of this object * - * Please use drm_gem_object_get() to acquire and drm_gem_object_put() - * or drm_gem_object_put_unlocked() to release a reference to a GEM + * Please use drm_gem_object_get() to acquire and drm_gem_object_put_locked() + * or drm_gem_object_put() to release a reference to a GEM * buffer object. */ struct kref refcount; @@ -272,8 +272,9 @@ struct drm_gem_object { * attachment point for the device. This is invariant over the lifetime * of a gem object. * - * The &drm_driver.gem_free_object callback is responsible for cleaning - * up the dma_buf attachment and references acquired at import time. + * The &drm_driver.gem_free_object_unlocked callback is responsible for + * cleaning up the dma_buf attachment and references acquired at import + * time. * * Note that the drm gem/prime core does not depend upon drivers setting * this field any more. So for drivers where this doesn't make sense @@ -362,29 +363,27 @@ static inline void drm_gem_object_get(struct drm_gem_object *obj) kref_get(&obj->refcount); } +__attribute__((nonnull)) +static inline void +__drm_gem_object_put(struct drm_gem_object *obj) +{ + kref_put(&obj->refcount, drm_gem_object_free); +} + /** - * __drm_gem_object_put - raw function to release a GEM buffer object reference + * drm_gem_object_put - drop a GEM buffer object reference * @obj: GEM buffer object * - * This function is meant to be used by drivers which are not encumbered with - * &drm_device.struct_mutex legacy locking and which are using the - * gem_free_object_unlocked callback. It avoids all the locking checks and - * locking overhead of drm_gem_object_put() and drm_gem_object_put_unlocked(). - * - * Drivers should never call this directly in their code. Instead they should - * wrap it up into a ``driver_gem_object_put(struct driver_gem_object *obj)`` - * wrapper function, and use that. Shared code should never call this, to - * avoid breaking drivers by accident which still depend upon - * &drm_device.struct_mutex locking. + * This releases a reference to @obj. */ static inline void -__drm_gem_object_put(struct drm_gem_object *obj) +drm_gem_object_put(struct drm_gem_object *obj) { - kref_put(&obj->refcount, drm_gem_object_free); + if (obj) + __drm_gem_object_put(obj); } -void drm_gem_object_put_unlocked(struct drm_gem_object *obj); -void drm_gem_object_put(struct drm_gem_object *obj); +void drm_gem_object_put_locked(struct drm_gem_object *obj); int drm_gem_handle_create(struct drm_file *file_priv, struct drm_gem_object *obj, |