diff options
-rw-r--r-- | drivers/gpu/drm/drm_gem.c | 17 | ||||
-rw-r--r-- | include/drm/drmP.h | 2 |
2 files changed, 15 insertions, 4 deletions
diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c index 0746ce07cae..b9046089e9e 100644 --- a/drivers/gpu/drm/drm_gem.c +++ b/drivers/gpu/drm/drm_gem.c @@ -390,13 +390,10 @@ EXPORT_SYMBOL(drm_gem_create_mmap_offset); /** Returns a reference to the object named by the handle. */ struct drm_gem_object * -drm_gem_object_lookup(struct drm_device *dev, struct drm_file *filp, - u32 handle) +drm_gem_object_lookup_locked(struct drm_file *filp, u32 handle) { struct drm_gem_object *obj; - mutex_lock(&filp->table_lock); - /* Check if we currently have a reference on the object */ obj = idr_find(&filp->object_idr, handle); if (obj == NULL) { @@ -406,6 +403,18 @@ drm_gem_object_lookup(struct drm_device *dev, struct drm_file *filp, drm_gem_object_reference(obj); + return obj; +} +EXPORT_SYMBOL(drm_gem_object_lookup_locked); + +struct drm_gem_object * +drm_gem_object_lookup(struct drm_device *dev, struct drm_file *filp, + u32 handle) +{ + struct drm_gem_object *obj; + + mutex_lock(&filp->table_lock); + obj = drm_gem_object_lookup_locked(filp, handle); mutex_unlock(&filp->table_lock); return obj; diff --git a/include/drm/drmP.h b/include/drm/drmP.h index fec34eab617..96f582d840d 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -1699,6 +1699,8 @@ int drm_gem_create_mmap_offset(struct drm_gem_object *obj); struct drm_gem_object *drm_gem_object_lookup(struct drm_device *dev, struct drm_file *filp, u32 handle); +struct drm_gem_object *drm_gem_object_lookup_locked(struct drm_file *filp, + u32 handle); int drm_gem_close_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv); int drm_gem_flink_ioctl(struct drm_device *dev, void *data, |