aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpiolib.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2013-02-27 20:04:06 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-02-27 22:10:15 -0500
commit62f516b8d6b0610c257b4f92264e00a8dee77a0b (patch)
treebf10ffd02463618c5aaf1632e294054d202167ed /drivers/gpio/gpiolib.c
parent37b61890d757f606c25ac5a247572cb7d5efde96 (diff)
gpio: convert to idr_alloc()
Convert to the much saner new idr interface. Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Linus Walleij <linus.walleij@linaro.org> Cc: Grant Likely <grant.likely@secretlab.ca> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/gpio/gpiolib.c')
-rw-r--r--drivers/gpio/gpiolib.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 4828fe7c66cb..fff9786cdc64 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -411,15 +411,10 @@ static int gpio_setup_irq(struct gpio_desc *desc, struct device *dev,
411 goto err_out; 411 goto err_out;
412 } 412 }
413 413
414 do { 414 ret = idr_alloc(&dirent_idr, value_sd, 1, 0, GFP_KERNEL);
415 ret = -ENOMEM; 415 if (ret < 0)
416 if (idr_pre_get(&dirent_idr, GFP_KERNEL))
417 ret = idr_get_new_above(&dirent_idr, value_sd,
418 1, &id);
419 } while (ret == -EAGAIN);
420
421 if (ret)
422 goto free_sd; 416 goto free_sd;
417 id = ret;
423 418
424 desc->flags &= GPIO_FLAGS_MASK; 419 desc->flags &= GPIO_FLAGS_MASK;
425 desc->flags |= (unsigned long)id << ID_SHIFT; 420 desc->flags |= (unsigned long)id << ID_SHIFT;