From a7d071a7952ded5ce401ac864106b22dc1df71e8 Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Wed, 20 Feb 2013 13:16:20 +1100 Subject: [PATCH] misc/tifm_core: convert to idr_alloc() Convert to the much saner new idr interface. Only compile tested. Signed-off-by: Tejun Heo Cc: Arnd Bergmann Cc: Alex Dubov Signed-off-by: Andrew Morton --- drivers/misc/tifm_core.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/misc/tifm_core.c b/drivers/misc/tifm_core.c index 0bd5349b0422..0ab7c922212c 100644 --- a/drivers/misc/tifm_core.c +++ b/drivers/misc/tifm_core.c @@ -196,13 +196,14 @@ int tifm_add_adapter(struct tifm_adapter *fm) { int rc; - if (!idr_pre_get(&tifm_adapter_idr, GFP_KERNEL)) - return -ENOMEM; - + idr_preload(GFP_KERNEL); spin_lock(&tifm_adapter_lock); - rc = idr_get_new(&tifm_adapter_idr, fm, &fm->id); + rc = idr_alloc(&tifm_adapter_idr, fm, 0, 0, GFP_NOWAIT); + if (rc >= 0) + fm->id = rc; spin_unlock(&tifm_adapter_lock); - if (rc) + idr_preload_end(); + if (rc < 0) return rc; dev_set_name(&fm->dev, "tifm%u", fm->id); -- 2.39.5