Skip to content

Commit

Permalink
mfd: 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 <tj@kernel.org>
Cc: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Tejun Heo authored and Linus Torvalds committed Feb 28, 2013
1 parent 7b51f47 commit 9f12563
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions drivers/mfd/rtsx_pcr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1091,15 +1091,14 @@ static int rtsx_pci_probe(struct pci_dev *pcidev,
}
handle->pcr = pcr;

if (!idr_pre_get(&rtsx_pci_idr, GFP_KERNEL)) {
ret = -ENOMEM;
goto free_handle;
}

idr_preload(GFP_KERNEL);
spin_lock(&rtsx_pci_lock);
ret = idr_get_new(&rtsx_pci_idr, pcr, &pcr->id);
ret = idr_alloc(&rtsx_pci_idr, pcr, 0, 0, GFP_NOWAIT);
if (ret >= 0)
pcr->id = ret;
spin_unlock(&rtsx_pci_lock);
if (ret)
idr_preload_end();
if (ret < 0)
goto free_handle;

pcr->pci = pcidev;
Expand Down

0 comments on commit 9f12563

Please sign in to comment.