diff options
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_gem.c')
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_gem.c | 36 |
1 files changed, 9 insertions, 27 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c index db8e9a355a01..ef92d147d8f0 100644 --- a/drivers/gpu/drm/radeon/radeon_gem.c +++ b/drivers/gpu/drm/radeon/radeon_gem.c | |||
@@ -69,9 +69,7 @@ int radeon_gem_object_create(struct radeon_device *rdev, int size, | |||
69 | if (r != -ERESTARTSYS) | 69 | if (r != -ERESTARTSYS) |
70 | DRM_ERROR("Failed to allocate GEM object (%d, %d, %u, %d)\n", | 70 | DRM_ERROR("Failed to allocate GEM object (%d, %d, %u, %d)\n", |
71 | size, initial_domain, alignment, r); | 71 | size, initial_domain, alignment, r); |
72 | mutex_lock(&rdev->ddev->struct_mutex); | 72 | drm_gem_object_unreference_unlocked(gobj); |
73 | drm_gem_object_unreference(gobj); | ||
74 | mutex_unlock(&rdev->ddev->struct_mutex); | ||
75 | return r; | 73 | return r; |
76 | } | 74 | } |
77 | gobj->driver_private = robj; | 75 | gobj->driver_private = robj; |
@@ -202,14 +200,10 @@ int radeon_gem_create_ioctl(struct drm_device *dev, void *data, | |||
202 | } | 200 | } |
203 | r = drm_gem_handle_create(filp, gobj, &handle); | 201 | r = drm_gem_handle_create(filp, gobj, &handle); |
204 | if (r) { | 202 | if (r) { |
205 | mutex_lock(&dev->struct_mutex); | 203 | drm_gem_object_unreference_unlocked(gobj); |
206 | drm_gem_object_unreference(gobj); | ||
207 | mutex_unlock(&dev->struct_mutex); | ||
208 | return r; | 204 | return r; |
209 | } | 205 | } |
210 | mutex_lock(&dev->struct_mutex); | 206 | drm_gem_object_handle_unreference_unlocked(gobj); |
211 | drm_gem_object_handle_unreference(gobj); | ||
212 | mutex_unlock(&dev->struct_mutex); | ||
213 | args->handle = handle; | 207 | args->handle = handle; |
214 | return 0; | 208 | return 0; |
215 | } | 209 | } |
@@ -236,9 +230,7 @@ int radeon_gem_set_domain_ioctl(struct drm_device *dev, void *data, | |||
236 | 230 | ||
237 | r = radeon_gem_set_domain(gobj, args->read_domains, args->write_domain); | 231 | r = radeon_gem_set_domain(gobj, args->read_domains, args->write_domain); |
238 | 232 | ||
239 | mutex_lock(&dev->struct_mutex); | 233 | drm_gem_object_unreference_unlocked(gobj); |
240 | drm_gem_object_unreference(gobj); | ||
241 | mutex_unlock(&dev->struct_mutex); | ||
242 | return r; | 234 | return r; |
243 | } | 235 | } |
244 | 236 | ||
@@ -255,9 +247,7 @@ int radeon_gem_mmap_ioctl(struct drm_device *dev, void *data, | |||
255 | } | 247 | } |
256 | robj = gobj->driver_private; | 248 | robj = gobj->driver_private; |
257 | args->addr_ptr = radeon_bo_mmap_offset(robj); | 249 | args->addr_ptr = radeon_bo_mmap_offset(robj); |
258 | mutex_lock(&dev->struct_mutex); | 250 | drm_gem_object_unreference_unlocked(gobj); |
259 | drm_gem_object_unreference(gobj); | ||
260 | mutex_unlock(&dev->struct_mutex); | ||
261 | return 0; | 251 | return 0; |
262 | } | 252 | } |
263 | 253 | ||
@@ -288,9 +278,7 @@ int radeon_gem_busy_ioctl(struct drm_device *dev, void *data, | |||
288 | default: | 278 | default: |
289 | break; | 279 | break; |
290 | } | 280 | } |
291 | mutex_lock(&dev->struct_mutex); | 281 | drm_gem_object_unreference_unlocked(gobj); |
292 | drm_gem_object_unreference(gobj); | ||
293 | mutex_unlock(&dev->struct_mutex); | ||
294 | return r; | 282 | return r; |
295 | } | 283 | } |
296 | 284 | ||
@@ -311,9 +299,7 @@ int radeon_gem_wait_idle_ioctl(struct drm_device *dev, void *data, | |||
311 | /* callback hw specific functions if any */ | 299 | /* callback hw specific functions if any */ |
312 | if (robj->rdev->asic->ioctl_wait_idle) | 300 | if (robj->rdev->asic->ioctl_wait_idle) |
313 | robj->rdev->asic->ioctl_wait_idle(robj->rdev, robj); | 301 | robj->rdev->asic->ioctl_wait_idle(robj->rdev, robj); |
314 | mutex_lock(&dev->struct_mutex); | 302 | drm_gem_object_unreference_unlocked(gobj); |
315 | drm_gem_object_unreference(gobj); | ||
316 | mutex_unlock(&dev->struct_mutex); | ||
317 | return r; | 303 | return r; |
318 | } | 304 | } |
319 | 305 | ||
@@ -331,9 +317,7 @@ int radeon_gem_set_tiling_ioctl(struct drm_device *dev, void *data, | |||
331 | return -EINVAL; | 317 | return -EINVAL; |
332 | robj = gobj->driver_private; | 318 | robj = gobj->driver_private; |
333 | r = radeon_bo_set_tiling_flags(robj, args->tiling_flags, args->pitch); | 319 | r = radeon_bo_set_tiling_flags(robj, args->tiling_flags, args->pitch); |
334 | mutex_lock(&dev->struct_mutex); | 320 | drm_gem_object_unreference_unlocked(gobj); |
335 | drm_gem_object_unreference(gobj); | ||
336 | mutex_unlock(&dev->struct_mutex); | ||
337 | return r; | 321 | return r; |
338 | } | 322 | } |
339 | 323 | ||
@@ -356,8 +340,6 @@ int radeon_gem_get_tiling_ioctl(struct drm_device *dev, void *data, | |||
356 | radeon_bo_get_tiling_flags(rbo, &args->tiling_flags, &args->pitch); | 340 | radeon_bo_get_tiling_flags(rbo, &args->tiling_flags, &args->pitch); |
357 | radeon_bo_unreserve(rbo); | 341 | radeon_bo_unreserve(rbo); |
358 | out: | 342 | out: |
359 | mutex_lock(&dev->struct_mutex); | 343 | drm_gem_object_unreference_unlocked(gobj); |
360 | drm_gem_object_unreference(gobj); | ||
361 | mutex_unlock(&dev->struct_mutex); | ||
362 | return r; | 344 | return r; |
363 | } | 345 | } |