aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjorn Andersson <bjorn.andersson@linaro.org>2016-10-19 22:40:08 -0400
committerBjorn Andersson <bjorn.andersson@linaro.org>2016-11-15 00:52:16 -0500
commit2b45cef5868a9ad012121f4f7f11c700bfb7f2e4 (patch)
treec4b1b74c659c5945d440a03ddfecac615417e2a6
parenta863af5d419361d3e657d4880dd3d7c490a8c4ba (diff)
remoteproc: Further extend the vdev life cycle
Tie the vdev (and hence vring) life cycle to the resource parsing and resource cleanup operations, allowing us to safely register and unregister virtio devices on the go. Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
-rw-r--r--drivers/remoteproc/remoteproc_core.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
index bb78316f8120..62de765a9498 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -377,6 +377,9 @@ static int rproc_handle_vdev(struct rproc *rproc, struct fw_rsc_vdev *rsc,
377 goto unwind_vring_allocations; 377 goto unwind_vring_allocations;
378 } 378 }
379 379
380 /* track the rvdevs list reference */
381 kref_get(&rvdev->refcount);
382
380 list_add_tail(&rvdev->node, &rproc->rvdevs); 383 list_add_tail(&rvdev->node, &rproc->rvdevs);
381 384
382 /* it is now safe to add the virtio device */ 385 /* it is now safe to add the virtio device */
@@ -839,8 +842,10 @@ static void rproc_resource_cleanup(struct rproc *rproc)
839 } 842 }
840 843
841 /* clean up remote vdev entries */ 844 /* clean up remote vdev entries */
842 list_for_each_entry_safe(rvdev, rvtmp, &rproc->rvdevs, node) 845 list_for_each_entry_safe(rvdev, rvtmp, &rproc->rvdevs, node) {
843 rproc_remove_virtio_dev(rvdev); 846 rproc_remove_virtio_dev(rvdev);
847 kref_put(&rvdev->refcount, rproc_vdev_release);
848 }
844} 849}
845 850
846/* 851/*