]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
drm/via: convert to idr_alloc()
authorTejun Heo <tj@kernel.org>
Thu, 7 Feb 2013 01:31:38 +0000 (12:31 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Mon, 18 Feb 2013 05:47:31 +0000 (16:47 +1100)
Convert to the much saner new idr interface.

Only compile tested.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: David Airlie <airlied@linux.ie>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
drivers/gpu/drm/via/via_mm.c

index 0d55432e02a25c4e4d2130c0adb430d71a55f4dc..0ab93ff0987328f04a27dc922de6d3f9984101d4 100644 (file)
@@ -148,17 +148,10 @@ int via_mem_alloc(struct drm_device *dev, void *data,
        if (retval)
                goto fail_alloc;
 
-again:
-       if (idr_pre_get(&dev_priv->object_idr, GFP_KERNEL) == 0) {
-               retval = -ENOMEM;
-               goto fail_idr;
-       }
-
-       retval = idr_get_new_above(&dev_priv->object_idr, item, 1, &user_key);
-       if (retval == -EAGAIN)
-               goto again;
-       if (retval)
+       retval = idr_alloc(&dev_priv->object_idr, item, 1, 0, GFP_KERNEL);
+       if (retval < 0)
                goto fail_idr;
+       user_key = retval;
 
        list_add(&item->owner_list, &file_priv->obj_list);
        mutex_unlock(&dev->struct_mutex);