mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 12:11:40 +00:00
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>
This commit is contained in:
parent
3ab4ee8f80
commit
57f2667cc7
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user