public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH 53/77] mtd: convert to idr_alloc()
       [not found] <1360179649-22465-1-git-send-email-tj@kernel.org>
@ 2013-02-06 19:40 ` Tejun Heo
  0 siblings, 0 replies; only message in thread
From: Tejun Heo @ 2013-02-06 19:40 UTC (permalink / raw)
  To: akpm; +Cc: Tejun Heo, linux-mtd, David Woodhouse, linux-kernel

Convert to the much saner new idr interface.

Only compile tested.

Signed-off-by: Tejun Heo <tj@kernel.org>
Tested-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: linux-mtd@lists.infradead.org
---
 drivers/mtd/mtdcore.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

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;
-- 
1.8.1

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2013-02-06 19:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1360179649-22465-1-git-send-email-tj@kernel.org>
2013-02-06 19:40 ` [PATCH 53/77] mtd: convert to idr_alloc() Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox