/* Removes the mapping from handle to filp for this object.  */
static int drm_gem_handle_delete(struct drm_file *filp, u32 handle)
/* Removes the mapping from handle to filp for this object.  */
static int drm_gem_handle_delete(struct drm_file *filp, u32 handle)
{
	struct drm_device *dev;
	struct drm_gem_object *obj;
	spin_lock(&filp->table_lock);
	obj = idr_find(&filp->object_idr, handle);
	if (obj == NULL) {
		spin_unlock(&filp->table_lock);
		return -EINVAL;
	}
	dev = obj->dev;
	idr_remove(&filp->object_idr, handle);
	spin_unlock(&filp->table_lock);
	mutex_lock(&dev->struct_mutex);
	drm_gem_object_handle_unreference(obj);
	mutex_unlock(&dev->struct_mutex);
	return 0;
}