Skip to content

Commit

Permalink
mtd: convert to idr_alloc()
Browse files Browse the repository at this point in the history
Convert to the much saner new idr interface.

Signed-off-by: Tejun Heo <tj@kernel.org>
Tested-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Tejun Heo authored and Linus Torvalds committed Feb 28, 2013
1 parent 803d9e0 commit 589e9c4
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions drivers/mtd/mtdcore.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 589e9c4

Please sign in to comment.