]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
drm/exynos: convert to idr_alloc()
authorTejun Heo <tj@kernel.org>
Thu, 7 Feb 2013 01:31:37 +0000 (12:31 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Mon, 18 Feb 2013 05:47:30 +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>
Cc: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
drivers/gpu/drm/exynos/exynos_drm_ipp.c

index 90398dfbfd75ed9fac8ad459196abb2e8fe4f960..1adce07ecb5bd6bba59af8556ddcff99428c61b3 100644 (file)
@@ -137,21 +137,15 @@ static int ipp_create_id(struct idr *id_idr, struct mutex *lock, void *obj,
 
        DRM_DEBUG_KMS("%s\n", __func__);
 
-again:
-       /* ensure there is space available to allocate a handle */
-       if (idr_pre_get(id_idr, GFP_KERNEL) == 0) {
-               DRM_ERROR("failed to get idr.\n");
-               return -ENOMEM;
-       }
-
        /* do the allocation under our mutexlock */
        mutex_lock(lock);
-       ret = idr_get_new_above(id_idr, obj, 1, (int *)idp);
+       ret = idr_alloc(id_idr, obj, 1, 0, GFP_KERNEL);
        mutex_unlock(lock);
-       if (ret == -EAGAIN)
-               goto again;
+       if (ret < 0)
+               return ret;
 
-       return ret;
+       *idp = ret;
+       return 0;
 }
 
 static void *ipp_find_obj(struct idr *id_idr, struct mutex *lock, u32 id)