Commit 2b45cef5 authored by Bjorn Andersson's avatar Bjorn Andersson

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: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
parent a863af5d
...@@ -377,6 +377,9 @@ static int rproc_handle_vdev(struct rproc *rproc, struct fw_rsc_vdev *rsc, ...@@ -377,6 +377,9 @@ static int rproc_handle_vdev(struct rproc *rproc, struct fw_rsc_vdev *rsc,
goto unwind_vring_allocations; goto unwind_vring_allocations;
} }
/* track the rvdevs list reference */
kref_get(&rvdev->refcount);
list_add_tail(&rvdev->node, &rproc->rvdevs); list_add_tail(&rvdev->node, &rproc->rvdevs);
/* it is now safe to add the virtio device */ /* it is now safe to add the virtio device */
...@@ -839,8 +842,10 @@ static void rproc_resource_cleanup(struct rproc *rproc) ...@@ -839,8 +842,10 @@ static void rproc_resource_cleanup(struct rproc *rproc)
} }
/* clean up remote vdev entries */ /* clean up remote vdev entries */
list_for_each_entry_safe(rvdev, rvtmp, &rproc->rvdevs, node) list_for_each_entry_safe(rvdev, rvtmp, &rproc->rvdevs, node) {
rproc_remove_virtio_dev(rvdev); rproc_remove_virtio_dev(rvdev);
kref_put(&rvdev->refcount, rproc_vdev_release);
}
} }
/* /*
......
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