Commit 589e9c4dace6995440c119486919ce95b180dd38
Committed by
Linus Torvalds
1 parent
803d9e043d
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
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>
Showing 1 changed file with 2 additions and 7 deletions Side-by-side Diff
drivers/mtd/mtdcore.c
... | ... | @@ -349,13 +349,8 @@ |
349 | 349 | BUG_ON(mtd->writesize == 0); |
350 | 350 | mutex_lock(&mtd_table_mutex); |
351 | 351 | |
352 | - do { | |
353 | - if (!idr_pre_get(&mtd_idr, GFP_KERNEL)) | |
354 | - goto fail_locked; | |
355 | - error = idr_get_new(&mtd_idr, mtd, &i); | |
356 | - } while (error == -EAGAIN); | |
357 | - | |
358 | - if (error) | |
352 | + i = idr_alloc(&mtd_idr, mtd, 0, 0, GFP_KERNEL); | |
353 | + if (i < 0) | |
359 | 354 | goto fail_locked; |
360 | 355 | |
361 | 356 | mtd->index = i; |