From: Francesco Valla <francesco@valla.it>
To: Bjorn Andersson <andersson@kernel.org>,
Mathieu Poirier <mathieu.poirier@linaro.org>,
Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>,
Joakim Zhang <joakim.zhang@cixtech.com>
Cc: linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org,
Francesco Valla <francesco@valla.it>
Subject: [PATCH 4/4] remoteproc: virtio: Stop de-referencing pdev from its children
Date: Sun, 08 Nov 2026 23:32:40 +0100 [thread overview]
Message-ID: <20261108-remoteproc_pdev_decouple-v1-4-3dc2fad4951d@valla.it> (raw)
In-Reply-To: <20261108-remoteproc_pdev_decouple-v1-0-3dc2fad4951d@valla.it>
The struct device underlying the rproc-virtio platform device is used to
perform some operations during the lifetime of the rproc_vdev. It is
however no longer necessary to keep a pointer to the platform device,
which is not really used but only de-referenced to access its struct
device; a pointer to the struct device itself is sufficient.
Signed-off-by: Francesco Valla <francesco@valla.it>
---
drivers/remoteproc/remoteproc_virtio.c | 6 +++---
include/linux/remoteproc.h | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/remoteproc/remoteproc_virtio.c b/drivers/remoteproc/remoteproc_virtio.c
index ac0103a5c261..4b778720d478 100644
--- a/drivers/remoteproc/remoteproc_virtio.c
+++ b/drivers/remoteproc/remoteproc_virtio.c
@@ -368,7 +368,7 @@ static void rproc_virtio_dev_release(struct device *dev)
static int rproc_add_virtio_dev(struct rproc_vdev *rvdev, int id)
{
struct rproc *rproc = rvdev->rproc;
- struct device *dev = &rvdev->pdev->dev;
+ struct device *dev = rvdev->dev;
struct virtio_device *vdev;
struct rproc_mem_entry *mem;
int ret;
@@ -482,7 +482,7 @@ static int rproc_vdev_do_start(struct rproc_subdev *subdev)
static void rproc_vdev_do_stop(struct rproc_subdev *subdev, bool crashed)
{
struct rproc_vdev *rvdev = container_of(subdev, struct rproc_vdev, subdev);
- struct device *dev = &rvdev->pdev->dev;
+ struct device *dev = rvdev->dev;
int ret;
ret = device_for_each_child(dev, NULL, rproc_remove_virtio_dev);
@@ -509,6 +509,7 @@ static int rproc_virtio_probe(struct platform_device *pdev)
if (!rvdev)
return -ENOMEM;
+ rvdev->dev = dev;
rvdev->id = rvdev_data->id;
rvdev->rproc = rproc;
rvdev->index = rvdev_data->index;
@@ -527,7 +528,6 @@ static int rproc_virtio_probe(struct platform_device *pdev)
}
platform_set_drvdata(pdev, rvdev);
- rvdev->pdev = pdev;
rsc = rvdev_data->rsc;
diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h
index 77ea0e1067e0..f3074c69098f 100644
--- a/include/linux/remoteproc.h
+++ b/include/linux/remoteproc.h
@@ -347,7 +347,7 @@ struct rproc_vring {
/**
* struct rproc_vdev - remoteproc state for a supported virtio device
* @subdev: handle for registering the vdev as a rproc subdevice
- * @pdev: remoteproc virtio platform device
+ * @dev: parent remoteproc virtio device
* @id: virtio device id (as in virtio_ids.h)
* @rproc: the rproc handle
* @vring: the vrings for this vdev
@@ -356,7 +356,7 @@ struct rproc_vring {
*/
struct rproc_vdev {
struct rproc_subdev subdev;
- struct platform_device *pdev;
+ struct device *dev;
unsigned int id;
struct rproc *rproc;
--
2.56.0
next prev parent reply other threads:[~2026-11-08 22:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-08 22:32 [PATCH 0/4] remoteproc: virtio: Fixes and cleanups in the vdev<->pdev relationship Francesco Valla
2026-11-08 22:32 ` [PATCH 1/4] remoteproc: virtio: Decouple vdev from the parent pdev Francesco Valla
2026-11-08 22:32 ` [PATCH 2/4] remoteproc: virtio: Rework memory release Francesco Valla
2026-11-08 22:32 ` [PATCH 3/4] remoteproc: virtio: Drop rvdevs list and associated functions Francesco Valla
2026-11-08 22:32 ` Francesco Valla [this message]
2026-11-09 14:19 ` [PATCH 0/4] remoteproc: virtio: Fixes and cleanups in the vdev<->pdev relationship 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=20261108-remoteproc_pdev_decouple-v1-4-3dc2fad4951d@valla.it \
--to=francesco@valla.it \
--cc=andersson@kernel.org \
--cc=arnaud.pouliquen@foss.st.com \
--cc=joakim.zhang@cixtech.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-remoteproc@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®