diff options
author | Luca Barbieri <luca@luca-barbieri.com> | 2010-02-09 00:49:12 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2010-02-10 23:22:34 -0500 |
commit | bc9025bdc4e2b591734cca17697093845007b63d (patch) | |
tree | a115cc34ee9650d94df7eb9d166ba98eb9d674a7 /drivers/gpu/drm/i915/i915_gem.c | |
parent | c3ae90c099bb62387507e86da7cf799850444b08 (diff) |
Use drm_gem_object_[handle_]unreference_unlocked where possible
Mostly obvious simplifications.
The i915 pread/pwrite ioctls, intel_overlay_put_image and
nouveau_gem_new were incorrectly using the locked versions
without locking: this is also fixed in this patch.
Signed-off-by: Luca Barbieri <luca@luca-barbieri.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/i915/i915_gem.c')
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index b4c8c0230689..6844ca4f4265 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -128,9 +128,7 @@ i915_gem_create_ioctl(struct drm_device *dev, void *data, | |||
128 | return -ENOMEM; | 128 | return -ENOMEM; |
129 | 129 | ||
130 | ret = drm_gem_handle_create(file_priv, obj, &handle); | 130 | ret = drm_gem_handle_create(file_priv, obj, &handle); |
131 | mutex_lock(&dev->struct_mutex); | 131 | drm_gem_object_handle_unreference_unlocked(obj); |
132 | drm_gem_object_handle_unreference(obj); | ||
133 | mutex_unlock(&dev->struct_mutex); | ||
134 | 132 | ||
135 | if (ret) | 133 | if (ret) |
136 | return ret; | 134 | return ret; |
@@ -488,7 +486,7 @@ i915_gem_pread_ioctl(struct drm_device *dev, void *data, | |||
488 | */ | 486 | */ |
489 | if (args->offset > obj->size || args->size > obj->size || | 487 | if (args->offset > obj->size || args->size > obj->size || |
490 | args->offset + args->size > obj->size) { | 488 | args->offset + args->size > obj->size) { |
491 | drm_gem_object_unreference(obj); | 489 | drm_gem_object_unreference_unlocked(obj); |
492 | return -EINVAL; | 490 | return -EINVAL; |
493 | } | 491 | } |
494 | 492 | ||
@@ -501,7 +499,7 @@ i915_gem_pread_ioctl(struct drm_device *dev, void *data, | |||
501 | file_priv); | 499 | file_priv); |
502 | } | 500 | } |
503 | 501 | ||
504 | drm_gem_object_unreference(obj); | 502 | drm_gem_object_unreference_unlocked(obj); |
505 | 503 | ||
506 | return ret; | 504 | return ret; |
507 | } | 505 | } |
@@ -961,7 +959,7 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data, | |||
961 | */ | 959 | */ |
962 | if (args->offset > obj->size || args->size > obj->size || | 960 | if (args->offset > obj->size || args->size > obj->size || |
963 | args->offset + args->size > obj->size) { | 961 | args->offset + args->size > obj->size) { |
964 | drm_gem_object_unreference(obj); | 962 | drm_gem_object_unreference_unlocked(obj); |
965 | return -EINVAL; | 963 | return -EINVAL; |
966 | } | 964 | } |
967 | 965 | ||
@@ -995,7 +993,7 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data, | |||
995 | DRM_INFO("pwrite failed %d\n", ret); | 993 | DRM_INFO("pwrite failed %d\n", ret); |
996 | #endif | 994 | #endif |
997 | 995 | ||
998 | drm_gem_object_unreference(obj); | 996 | drm_gem_object_unreference_unlocked(obj); |
999 | 997 | ||
1000 | return ret; | 998 | return ret; |
1001 | } | 999 | } |
@@ -1138,9 +1136,7 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data, | |||
1138 | PROT_READ | PROT_WRITE, MAP_SHARED, | 1136 | PROT_READ | PROT_WRITE, MAP_SHARED, |
1139 | args->offset); | 1137 | args->offset); |
1140 | up_write(¤t->mm->mmap_sem); | 1138 | up_write(¤t->mm->mmap_sem); |
1141 | mutex_lock(&dev->struct_mutex); | 1139 | drm_gem_object_unreference_unlocked(obj); |
1142 | drm_gem_object_unreference(obj); | ||
1143 | mutex_unlock(&dev->struct_mutex); | ||
1144 | if (IS_ERR((void *)addr)) | 1140 | if (IS_ERR((void *)addr)) |
1145 | return addr; | 1141 | return addr; |
1146 | 1142 | ||