Skip to content

Commit

Permalink
drm: Don't reference objects in the flink name idr
Browse files Browse the repository at this point in the history
There's no reason to keep a reference to objects in the name idr.  Each
handle to an object has a reference to the object and just before we
destroy the last handle we take the object out of the name idr.  Thus,
if an object is in the name idr, there's at least one reference to the
object.

Or to put it another way, the name idr reference will never keep the
object alive.  It just looks like it, which is confusing.

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
  • Loading branch information
Kristian Hogsberg authored and Dave Airlie committed Dec 18, 2013
1 parent 520edd1 commit ee61c73
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions drivers/gpu/drm/drm_gem.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,6 @@ drm_gem_remove_prime_handles(struct drm_gem_object *obj, struct drm_file *filp)
mutex_unlock(&filp->prime.lock);
}

static void drm_gem_object_ref_bug(struct kref *list_kref)
{
BUG();
}

/**
* Called after the last handle to the object has been closed
*
Expand All @@ -195,13 +190,6 @@ static void drm_gem_object_handle_free(struct drm_gem_object *obj)
if (obj->name) {
idr_remove(&dev->object_name_idr, obj->name);
obj->name = 0;
/*
* The object name held a reference to this object, drop
* that now.
*
* This cannot be the last reference, since the handle holds one too.
*/
kref_put(&obj->refcount, drm_gem_object_ref_bug);
}
}

Expand Down Expand Up @@ -602,9 +590,6 @@ drm_gem_flink_ioctl(struct drm_device *dev, void *data,
goto err;

obj->name = ret;

/* Allocate a reference for the name table. */
drm_gem_object_reference(obj);
}

args->name = (uint64_t) obj->name;
Expand Down

0 comments on commit ee61c73

Please sign in to comment.