summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2013-01-08 11:45:00 -0800
committerEric Anholt <eric@anholt.net>2013-01-08 14:49:29 -0800
commit4fb9377a357348d7e1a469d0febcad311236163f (patch)
tree38403ff1cecc0a3139974be5fdbb17d7dd4e83d8
parent653b8199f7cc44d5a10757862fd684dad2276361 (diff)
drm: Expose a variant of drm_gem_object_lookup where the lock is held.
Signed-off-by: Eric Anholt <eric@anholt.net>
-rw-r--r--drivers/gpu/drm/drm_gem.c17
-rw-r--r--include/drm/drmP.h2
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,