diff options
author | Tejun Heo <tj@kernel.org> | 2013-02-27 20:04:31 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-27 22:10:17 -0500 |
commit | 57f2667cc7ebf69bd5fdb26f132228d331766ea8 (patch) | |
tree | 9dbff0a6cc5cbe9d525835edacb606ded129f2d0 /drivers/misc | |
parent | 3ab4ee8f809cac9587e6795243349beda179f6ff (diff) |
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>
Diffstat (limited to 'drivers/misc')
-rw-r--r-- | drivers/misc/tifm_core.c | 11 |
1 files 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) | |||
196 | { | 196 | { |
197 | int rc; | 197 | int rc; |
198 | 198 | ||
199 | if (!idr_pre_get(&tifm_adapter_idr, GFP_KERNEL)) | 199 | idr_preload(GFP_KERNEL); |
200 | return -ENOMEM; | ||
201 | |||
202 | spin_lock(&tifm_adapter_lock); | 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 | spin_unlock(&tifm_adapter_lock); | 204 | spin_unlock(&tifm_adapter_lock); |
205 | if (rc) | 205 | idr_preload_end(); |
206 | if (rc < 0) | ||
206 | return rc; | 207 | return rc; |
207 | 208 | ||
208 | dev_set_name(&fm->dev, "tifm%u", fm->id); | 209 | dev_set_name(&fm->dev, "tifm%u", fm->id); |