From 49e8e3372afcf5fab9ffef5691d87ad8bc19599a Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Fri, 2 May 2008 10:36:00 -0700 Subject: Remove drm_driver argument to functions taking drm_gem_object. Now that drm_gem_object has a drm_driver * in it, functions don't need both parameters. --- linux-core/drmP.h | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'linux-core/drmP.h') diff --git a/linux-core/drmP.h b/linux-core/drmP.h index 0df9f19b..d2dc065a 100644 --- a/linux-core/drmP.h +++ b/linux-core/drmP.h @@ -740,10 +740,8 @@ struct drm_driver { * * Returns 0 on success. */ - int (*gem_init_object) (struct drm_device *dev, - struct drm_gem_object *obj); - void (*gem_free_object) (struct drm_device *dev, - struct drm_gem_object *obj); + int (*gem_init_object) (struct drm_gem_object *obj); + void (*gem_free_object) (struct drm_gem_object *obj); struct drm_fence_driver *fence_driver; struct drm_bo_driver *bo_driver; @@ -1307,11 +1305,23 @@ static inline struct drm_memrange *drm_get_mm(struct drm_memrange_node *block) return block->mm; } +void +drm_gem_object_free (struct kref *kref); + /* Graphics Execution Manager library functions (drm_gem.c) */ -void drm_gem_object_reference(struct drm_device *dev, - struct drm_gem_object *obj); -void drm_gem_object_unreference(struct drm_device *dev, - struct drm_gem_object *obj); +static inline void drm_gem_object_reference(struct drm_gem_object *obj) +{ + kref_get(&obj->refcount); +} + +static inline void drm_gem_object_unreference(struct drm_gem_object *obj) +{ + if (obj == NULL) + return; + + kref_put (&obj->refcount, drm_gem_object_free); +} + struct drm_gem_object * drm_gem_object_lookup(struct drm_device *dev, struct drm_file *filp, int handle); -- cgit v1.2.3