Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Tejun Heo and committed by
Linus Torvalds
62f516b8 37b61890

+3 -8
+3 -8
drivers/gpio/gpiolib.c
··· 411 411 goto err_out; 412 412 } 413 413 414 - do { 415 - ret = -ENOMEM; 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) 414 + ret = idr_alloc(&dirent_idr, value_sd, 1, 0, GFP_KERNEL); 415 + if (ret < 0) 422 416 goto free_sd; 417 + id = ret; 423 418 424 419 desc->flags &= GPIO_FLAGS_MASK; 425 420 desc->flags |= (unsigned long)id << ID_SHIFT;