All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
To: Bjorn Andersson <bjorn.andersson@linaro.org>,
	Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: <linux-remoteproc@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,
	<linux-stm32@st-md-mailman.stormreply.com>,
	<arnaud.pouliquen@foss.st.com>
Subject: [RFC PATCH v2 2/6] remoteproc: core: Introduce rproc_register_rvdev function
Date: Wed, 22 Dec 2021 09:23:45 +0100	[thread overview]
Message-ID: <20211222082349.30378-3-arnaud.pouliquen@foss.st.com> (raw)
In-Reply-To: <20211222082349.30378-1-arnaud.pouliquen@foss.st.com>

The rproc structure contains a list of registered rproc_vdev structure.
To be able to move the management of the rproc_vdev structure in
remoteproc_virtio.c (i.e rproc_rvdev_add_device and
rproc_rvdev_remove_device functions), introduce the rproc_register_rvdev
and rproc_unregister_rvdev functions.
These functions will be exported by the remoteproc_core.c.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
---
Update vs previous revision:
  - add rproc struct as parameter of the rproc_register_rvdev function
---
 drivers/remoteproc/remoteproc_core.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
index d1f1c5c25bd7..fcc55dbfba3b 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -484,6 +484,18 @@ static int copy_dma_range_map(struct device *to, struct device *from)
 	return 0;
 }
 
+static void rproc_register_rvdev(struct rproc *rproc, struct rproc_vdev *rvdev)
+{
+	if (rvdev && rproc)
+		list_add_tail(&rvdev->node, &rproc->rvdevs);
+}
+
+static void rproc_unregister_rvdev(struct rproc_vdev *rvdev)
+{
+	if (rvdev)
+		list_del(&rvdev->node);
+}
+
 static int rproc_rvdev_add_device(struct rproc_vdev *rvdev)
 {
 	struct rproc *rproc = rvdev->rproc;
@@ -516,7 +528,7 @@ static int rproc_rvdev_add_device(struct rproc_vdev *rvdev)
 			 dma_get_mask(rproc->dev.parent), ERR_PTR(ret));
 	}
 
-	list_add_tail(&rvdev->node, &rproc->rvdevs);
+	rproc_register_rvdev(rproc, rvdev);
 
 	rvdev->subdev.start = rproc_vdev_do_start;
 	rvdev->subdev.stop = rproc_vdev_do_stop;
@@ -535,7 +547,7 @@ static void rproc_rvdev_remove_device(struct rproc_vdev *rvdev)
 	struct rproc *rproc = rvdev->rproc;
 
 	rproc_remove_subdev(rproc, &rvdev->subdev);
-	list_del(&rvdev->node);
+	rproc_unregister_rvdev(rvdev);
 	device_unregister(&rvdev->dev);
 }
 
-- 
2.17.1


  parent reply	other threads:[~2021-12-22  8:24 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-22  8:23 [RFC PATCH v2 0/6] remoteproc: restructure the remoteproc VirtIO device Arnaud Pouliquen
2021-12-22  8:23 ` [RFC PATCH v2 1/6] remoteproc: core: Introduce virtio device add/remove functions Arnaud Pouliquen
2022-01-04 19:08   ` Mathieu Poirier
2022-01-05  8:05     ` Arnaud POULIQUEN
2022-01-05 18:05       ` Mathieu Poirier
2021-12-22  8:23 ` Arnaud Pouliquen [this message]
2021-12-22  8:23 ` [RFC PATCH v2 3/6] remoteproc: Move rproc_vdev management to remoteproc_virtio.c Arnaud Pouliquen
2022-01-05 18:32   ` Mathieu Poirier
2021-12-22  8:23 ` [RFC PATCH v2 4/6] remoteproc: virtio: Create platform device for the remoteproc_virtio Arnaud Pouliquen
2022-01-06 18:53   ` Mathieu Poirier
2022-01-07  9:30     ` Arnaud POULIQUEN
2021-12-22  8:23 ` [RFC PATCH v2 5/6] remoteproc: virtio: Add helper to create platform device Arnaud Pouliquen
2022-01-06 18:22   ` Mathieu Poirier
2021-12-22  8:23 ` [RFC PATCH v2 6/6] remoteproc: Instantiate the new remoteproc virtio " Arnaud Pouliquen
2022-01-06 18:48   ` Mathieu Poirier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211222082349.30378-3-arnaud.pouliquen@foss.st.com \
    --to=arnaud.pouliquen@foss.st.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=mathieu.poirier@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.