]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
gpio: convert to idr_alloc()
authorTejun Heo <tj@kernel.org>
Wed, 20 Feb 2013 02:16:13 +0000 (13:16 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 20 Feb 2013 05:53:45 +0000 (16:53 +1100)
Convert to the much saner new idr interface.

Only compile tested.

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>
drivers/gpio/gpiolib.c

index 4828fe7c66cb8d356f307698d1206437db19c3e5..fff9786cdc643120f933154366237a8d6b332e8d 100644 (file)
@@ -411,15 +411,10 @@ static int gpio_setup_irq(struct gpio_desc *desc, struct device *dev,
                        goto err_out;
                }
 
-               do {
-                       ret = -ENOMEM;
-                       if (idr_pre_get(&dirent_idr, GFP_KERNEL))
-                               ret = idr_get_new_above(&dirent_idr, value_sd,
-                                                       1, &id);
-               } while (ret == -EAGAIN);
-
-               if (ret)
+               ret = idr_alloc(&dirent_idr, value_sd, 1, 0, GFP_KERNEL);
+               if (ret < 0)
                        goto free_sd;
+               id = ret;
 
                desc->flags &= GPIO_FLAGS_MASK;
                desc->flags |= (unsigned long)id << ID_SHIFT;