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

misc/tifm_core: convert to idr_alloc()

Convert to the much saner new idr interface.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Alex Dubov <oakad@yahoo.com>
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
57f2667c 3ab4ee8f

+6 -5
+6 -5
drivers/misc/tifm_core.c
··· 196 196 { 197 197 int rc; 198 198 199 - if (!idr_pre_get(&tifm_adapter_idr, GFP_KERNEL)) 200 - return -ENOMEM; 201 - 199 + idr_preload(GFP_KERNEL); 202 200 spin_lock(&tifm_adapter_lock); 203 - rc = idr_get_new(&tifm_adapter_idr, fm, &fm->id); 201 + rc = idr_alloc(&tifm_adapter_idr, fm, 0, 0, GFP_NOWAIT); 202 + if (rc >= 0) 203 + fm->id = rc; 204 204 spin_unlock(&tifm_adapter_lock); 205 - if (rc) 205 + idr_preload_end(); 206 + if (rc < 0) 206 207 return rc; 207 208 208 209 dev_set_name(&fm->dev, "tifm%u", fm->id);