Skip to content

Commit

Permalink
misc/tifm_core: convert to idr_alloc()
Browse files Browse the repository at this point in the history
Convert to the much saner new idr interface.

Signed-off-by: Tejun Heo <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Alex Dubov <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
htejun authored and torvalds committed Feb 28, 2013
1 parent 3ab4ee8 commit 57f2667
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions drivers/misc/tifm_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 57f2667

Please sign in to comment.