Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1504477

[PATCH 07/11] remoteproc: Further extend the vdev life cycle

From Bjorn Andersson <bjorn.andersson@linaro.org>
Newsgroups linux.kernel
Subject [PATCH 07/11] remoteproc: Further extend the vdev life cycle
Date 2016-10-20 04:50 +0200
Message-ID <subAC-1wS-29@gated-at.bofh.it> (permalink)
References <subAB-1wS-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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>
---
 drivers/remoteproc/remoteproc_core.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
index e4509c8dd8e8..1d2f4b2dd05d 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,
 			goto unwind_vring_allocations;
 	}
 
+	/* track the rvdevs list reference */
+	kref_get(&rvdev->refcount);
+
 	list_add_tail(&rvdev->node, &rproc->rvdevs);
 
 	/* it is now safe to add the virtio device */
@@ -839,8 +842,10 @@ static void rproc_resource_cleanup(struct rproc *rproc)
 	}
 
 	/* 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);
+		kref_put(&rvdev->refcount, rproc_vdev_release);
+	}
 }
 
 /*
-- 
2.5.0

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 00/11] rproc subdevice support Bjorn Andersson <bjorn.andersson@linaro.org> - 2016-10-20 04:50 +0200
  [PATCH 05/11] remoteproc: Assign kref to rproc_vdev Bjorn Andersson <bjorn.andersson@linaro.org> - 2016-10-20 04:50 +0200
  [PATCH 06/11] remoteproc: virtio: Anchor vring life cycle in vdev Bjorn Andersson <bjorn.andersson@linaro.org> - 2016-10-20 04:50 +0200
  [PATCH 09/11] remoteproc: Update max_notifyid as we allocate vrings Bjorn Andersson <bjorn.andersson@linaro.org> - 2016-10-20 04:50 +0200
  [PATCH 08/11] remoteproc: Decouple vdev resources and devices Bjorn Andersson <bjorn.andersson@linaro.org> - 2016-10-20 04:50 +0200
  [PATCH 01/11] remoteproc: Introduce subdevices Bjorn Andersson <bjorn.andersson@linaro.org> - 2016-10-20 04:50 +0200
  [PATCH 03/11] remoteproc: wcnss: Bond SMD edge to remoteproc Bjorn Andersson <bjorn.andersson@linaro.org> - 2016-10-20 04:50 +0200
  [PATCH 11/11] remoteproc: Merge table_ptr and cached_table pointers Bjorn Andersson <bjorn.andersson@linaro.org> - 2016-10-20 04:50 +0200
  [PATCH 04/11] dt-binding: remoteproc: wcnss: Allow describing smd edge Bjorn Andersson <bjorn.andersson@linaro.org> - 2016-10-20 04:50 +0200
  [PATCH 10/11] remoteproc: Remove custom vdev handler list Bjorn Andersson <bjorn.andersson@linaro.org> - 2016-10-20 04:50 +0200
  [PATCH 07/11] remoteproc: Further extend the vdev life cycle Bjorn Andersson <bjorn.andersson@linaro.org> - 2016-10-20 04:50 +0200

csiph-web