mtd: convert to idr_alloc()
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>wifi-calibration
parent
803d9e043d
commit
589e9c4dac
|
@ -349,13 +349,8 @@ int add_mtd_device(struct mtd_info *mtd)
|
||||||
BUG_ON(mtd->writesize == 0);
|
BUG_ON(mtd->writesize == 0);
|
||||||
mutex_lock(&mtd_table_mutex);
|
mutex_lock(&mtd_table_mutex);
|
||||||
|
|
||||||
do {
|
i = idr_alloc(&mtd_idr, mtd, 0, 0, GFP_KERNEL);
|
||||||
if (!idr_pre_get(&mtd_idr, GFP_KERNEL))
|
if (i < 0)
|
||||||
goto fail_locked;
|
|
||||||
error = idr_get_new(&mtd_idr, mtd, &i);
|
|
||||||
} while (error == -EAGAIN);
|
|
||||||
|
|
||||||
if (error)
|
|
||||||
goto fail_locked;
|
goto fail_locked;
|
||||||
|
|
||||||
mtd->index = i;
|
mtd->index = i;
|
||||||
|
|
Loading…
Reference in New Issue