Commit 15fc6110 authored by Tejun Heo's avatar Tejun Heo Committed by Linus Torvalds

remoteproc: convert to idr_alloc()

Convert to the much saner new idr interface.
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Cc: Ohad Ben-Cohen <ohad@wizery.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 19dd2da3
...@@ -199,11 +199,6 @@ int rproc_alloc_vring(struct rproc_vdev *rvdev, int i) ...@@ -199,11 +199,6 @@ int rproc_alloc_vring(struct rproc_vdev *rvdev, int i)
/* actual size of vring (in bytes) */ /* actual size of vring (in bytes) */
size = PAGE_ALIGN(vring_size(rvring->len, rvring->align)); 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 * Allocate non-cacheable memory for the vring. In the future
* this call will also configure the IOMMU for us * this call will also configure the IOMMU for us
...@@ -221,12 +216,13 @@ int rproc_alloc_vring(struct rproc_vdev *rvdev, int i) ...@@ -221,12 +216,13 @@ int rproc_alloc_vring(struct rproc_vdev *rvdev, int i)
* TODO: let the rproc know the notifyid of this vring * TODO: let the rproc know the notifyid of this vring
* TODO: support predefined notifyids (via resource table) * 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) { 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); dma_free_coherent(dev->parent, size, va, dma);
return ret; return ret;
} }
notifyid = ret;
/* Store largest notifyid */ /* Store largest notifyid */
rproc->max_notifyid = max(rproc->max_notifyid, notifyid); rproc->max_notifyid = max(rproc->max_notifyid, notifyid);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment