diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2010-04-09 15:05:05 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2010-04-19 23:19:33 -0400 |
commit | fd632aa34c8592fb1d37fc83cbffa827bc7dd42c (patch) | |
tree | 5c6a0fc186e297590aee2c050b837a721db337b2 /drivers/gpu/drm/drm_gem.c | |
parent | 1d397043bcc2c8cdccb584a8ef73131f28f18e4c (diff) |
drm: free core gem object from driver callbacks
When drivers embed the core gem object into their own structures,
they'll have to do this. Temporarily this results in an ugly
kfree(gem_obj);
in every gem driver.
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/drm_gem.c')
-rw-r--r-- | drivers/gpu/drm/drm_gem.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c index 3b64d0ef1998..33dad3fa6043 100644 --- a/drivers/gpu/drm/drm_gem.c +++ b/drivers/gpu/drm/drm_gem.c | |||
@@ -422,15 +422,15 @@ drm_gem_release(struct drm_device *dev, struct drm_file *file_private) | |||
422 | idr_destroy(&file_private->object_idr); | 422 | idr_destroy(&file_private->object_idr); |
423 | } | 423 | } |
424 | 424 | ||
425 | static void | 425 | void |
426 | drm_gem_object_free_common(struct drm_gem_object *obj) | 426 | drm_gem_object_release(struct drm_gem_object *obj) |
427 | { | 427 | { |
428 | struct drm_device *dev = obj->dev; | 428 | struct drm_device *dev = obj->dev; |
429 | fput(obj->filp); | 429 | fput(obj->filp); |
430 | atomic_dec(&dev->object_count); | 430 | atomic_dec(&dev->object_count); |
431 | atomic_sub(obj->size, &dev->object_memory); | 431 | atomic_sub(obj->size, &dev->object_memory); |
432 | kfree(obj); | ||
433 | } | 432 | } |
433 | EXPORT_SYMBOL(drm_gem_object_release); | ||
434 | 434 | ||
435 | /** | 435 | /** |
436 | * Called after the last reference to the object has been lost. | 436 | * Called after the last reference to the object has been lost. |
@@ -448,8 +448,6 @@ drm_gem_object_free(struct kref *kref) | |||
448 | 448 | ||
449 | if (dev->driver->gem_free_object != NULL) | 449 | if (dev->driver->gem_free_object != NULL) |
450 | dev->driver->gem_free_object(obj); | 450 | dev->driver->gem_free_object(obj); |
451 | |||
452 | drm_gem_object_free_common(obj); | ||
453 | } | 451 | } |
454 | EXPORT_SYMBOL(drm_gem_object_free); | 452 | EXPORT_SYMBOL(drm_gem_object_free); |
455 | 453 | ||
@@ -472,8 +470,6 @@ drm_gem_object_free_unlocked(struct kref *kref) | |||
472 | dev->driver->gem_free_object(obj); | 470 | dev->driver->gem_free_object(obj); |
473 | mutex_unlock(&dev->struct_mutex); | 471 | mutex_unlock(&dev->struct_mutex); |
474 | } | 472 | } |
475 | |||
476 | drm_gem_object_free_common(obj); | ||
477 | } | 473 | } |
478 | EXPORT_SYMBOL(drm_gem_object_free_unlocked); | 474 | EXPORT_SYMBOL(drm_gem_object_free_unlocked); |
479 | 475 | ||