]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
mfd: convert to idr_alloc()
authorTejun Heo <tj@kernel.org>
Thu, 7 Feb 2013 01:31:43 +0000 (12:31 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Mon, 18 Feb 2013 05:47:34 +0000 (16:47 +1100)
Convert to the much saner new idr interface.

Only compile tested.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
drivers/mfd/rtsx_pcr.c

index 481a98a10ecde331aca22121427aa9d6ee5c4113..2f12cc13489ab1c1bd2051502c3469374175c61c 100644 (file)
@@ -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;