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

Only compile tested.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Ohad Ben-Cohen <ohad@wizery.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
drivers/remoteproc/remoteproc_core.c

index 663ea013b3ee85c19f4afde9679953bec56e2fce..2bfa08ad2191e1c28bc080d35587cc8b23f3547d 100644 (file)
@@ -199,11 +199,6 @@ int rproc_alloc_vring(struct rproc_vdev *rvdev, int i)
        /* actual size of vring (in bytes) */
        size = PAGE_ALIGN(vring_size(rvring->len, rvring->align));
 
-       if (!idr_pre_get(&rproc->notifyids, GFP_KERNEL)) {
-               dev_err(dev, "idr_pre_get failed\n");
-               return -ENOMEM;
-       }
-
        /*
         * Allocate non-cacheable memory for the vring. In the future
         * this call will also configure the IOMMU for us
@@ -219,12 +214,13 @@ int rproc_alloc_vring(struct rproc_vdev *rvdev, int i)
         * TODO: assign a notifyid for rvdev updates as well
         * TODO: support predefined notifyids (via resource table)
         */
-       ret = idr_get_new(&rproc->notifyids, rvring, &notifyid);
+       ret = idr_alloc(&rproc->notifyids, rvring, 0, 0, GFP_KERNEL);
        if (ret) {
-               dev_err(dev, "idr_get_new failed: %d\n", ret);
+               dev_err(dev, "idr_alloc failed: %d\n", ret);
                dma_free_coherent(dev->parent, size, va, dma);
                return ret;
        }
+       notifyid = ret;
 
        dev_dbg(dev, "vring%d: va %p dma %llx size %x idr %d\n", i, va,
                                (unsigned long long)dma, size, notifyid);