Skip to content

Commit 15fc611

Browse files
htejuntorvalds
authored andcommitted
remoteproc: convert to idr_alloc()
Convert to the much saner new idr interface. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Ohad Ben-Cohen <ohad@wizery.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 19dd2da commit 15fc611

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

‎drivers/remoteproc/remoteproc_core.c‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,6 @@ int rproc_alloc_vring(struct rproc_vdev *rvdev, int i)
199199
/* actual size of vring (in bytes) */
200200
size = PAGE_ALIGN(vring_size(rvring->len, rvring->align));
201201

202-
if (!idr_pre_get(&rproc->notifyids, GFP_KERNEL)) {
203-
dev_err(dev, "idr_pre_get failed\n");
204-
return -ENOMEM;
205-
}
206-
207202
/*
208203
* Allocate non-cacheable memory for the vring. In the future
209204
* this call will also configure the IOMMU for us
@@ -221,12 +216,13 @@ int rproc_alloc_vring(struct rproc_vdev *rvdev, int i)
221216
* TODO: let the rproc know the notifyid of this vring
222217
* TODO: support predefined notifyids (via resource table)
223218
*/
224-
ret = idr_get_new(&rproc->notifyids, rvring, &notifyid);
219+
ret = idr_alloc(&rproc->notifyids, rvring, 0, 0, GFP_KERNEL);
225220
if (ret) {
226-
dev_err(dev, "idr_get_new failed: %d\n", ret);
221+
dev_err(dev, "idr_alloc failed: %d\n", ret);
227222
dma_free_coherent(dev->parent, size, va, dma);
228223
return ret;
229224
}
225+
notifyid = ret;
230226

231227
/* Store largest notifyid */
232228
rproc->max_notifyid = max(rproc->max_notifyid, notifyid);

0 commit comments

Comments
 (0)