Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 3479 → Rev 3480

/drivers/video/drm/drm_gem.c
217,6 → 217,9
* we may want to use ida for number allocation and a hash table
* for the pointers, anyway.
*/
if(handle == -2)
printf("%s handle %d\n", __FUNCTION__, handle);
 
spin_lock(&filp->table_lock);
 
/* Check if we currently have a reference on the object */
257,21 → 260,19
int ret;
 
/*
* Get the user-visible handle using idr.
* Get the user-visible handle using idr. Preload and perform
* allocation under our spinlock.
*/
again:
/* ensure there is space available to allocate a handle */
if (idr_pre_get(&file_priv->object_idr, GFP_KERNEL) == 0)
return -ENOMEM;
idr_preload(GFP_KERNEL);
spin_lock(&file_priv->table_lock);
 
/* do the allocation under our spinlock */
spin_lock(&file_priv->table_lock);
ret = idr_get_new_above(&file_priv->object_idr, obj, 1, (int *)handlep);
ret = idr_alloc(&file_priv->object_idr, obj, 1, 0, GFP_NOWAIT);
 
spin_unlock(&file_priv->table_lock);
if (ret == -EAGAIN)
goto again;
else if (ret)
idr_preload_end();
if (ret < 0)
return ret;
*handlep = ret;
 
drm_gem_object_handle_reference(obj);
 
384,6 → 385,9
{
struct drm_gem_object *obj;
 
if(handle == -2)
printf("%s handle %d\n", __FUNCTION__, handle);
 
spin_lock(&filp->table_lock);
 
/* Check if we currently have a reference on the object */
439,23 → 443,18
if (obj == NULL)
return -ENOENT;
 
again:
if (idr_pre_get(&dev->object_name_idr, GFP_KERNEL) == 0) {
ret = -ENOMEM;
goto err;
}
 
idr_preload(GFP_KERNEL);
spin_lock(&dev->object_name_lock);
if (!obj->name) {
ret = idr_get_new_above(&dev->object_name_idr, obj, 1,
&obj->name);
ret = idr_alloc(&dev->object_name_idr, obj, 1, 0, GFP_NOWAIT);
obj->name = ret;
args->name = (uint64_t) obj->name;
spin_unlock(&dev->object_name_lock);
idr_preload_end();
 
if (ret == -EAGAIN)
goto again;
else if (ret)
if (ret < 0)
goto err;
ret = 0;
 
/* Allocate a reference for the name table. */
drm_gem_object_reference(obj);
462,6 → 461,7
} else {
args->name = (uint64_t) obj->name;
spin_unlock(&dev->object_name_lock);
idr_preload_end();
ret = 0;
}
 
488,6 → 488,9
if (!(dev->driver->driver_features & DRIVER_GEM))
return -ENODEV;
 
if(handle == -2)
printf("%s handle %d\n", __FUNCTION__, handle);
 
spin_lock(&dev->object_name_lock);
obj = idr_find(&dev->object_name_idr, (int) args->name);
if (obj)
549,8 → 552,6
{
idr_for_each(&file_private->object_idr,
&drm_gem_object_release_handle, file_private);
 
idr_remove_all(&file_private->object_idr);
idr_destroy(&file_private->object_idr);
}
#endif