From: Tejun Heo Date: Thu, 28 Feb 2013 01:04:33 +0000 (-0800) Subject: mtd: convert to idr_alloc() X-Git-Tag: v3.9~314^2~68 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=589e9c4dace6995440c119486919ce95b180dd38;p=platform%2Fkernel%2Flinux-amlogic.git mtd: convert to idr_alloc() Convert to the much saner new idr interface. Signed-off-by: Tejun Heo Tested-by: Ezequiel Garcia Cc: David Woodhouse Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index ec794a7..61d5f56 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c @@ -349,13 +349,8 @@ int add_mtd_device(struct mtd_info *mtd) BUG_ON(mtd->writesize == 0); mutex_lock(&mtd_table_mutex); - do { - if (!idr_pre_get(&mtd_idr, GFP_KERNEL)) - goto fail_locked; - error = idr_get_new(&mtd_idr, mtd, &i); - } while (error == -EAGAIN); - - if (error) + i = idr_alloc(&mtd_idr, mtd, 0, 0, GFP_KERNEL); + if (i < 0) goto fail_locked; mtd->index = i;