From: Tejun Heo Date: Thu, 28 Feb 2013 01:04:06 +0000 (-0800) Subject: gpio: convert to idr_alloc() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=62f516b8d6b0610c257b4f92264e00a8dee77a0b;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git gpio: convert to idr_alloc() Convert to the much saner new idr interface. Signed-off-by: Tejun Heo Acked-by: Linus Walleij Cc: Grant Likely Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- 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, 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;