[PATCH 4/4] remoteproc: virtio: Stop de-referencing pdev from its children
From: Francesco Valla
Date: Sun Nov 08 2026 - 17:38:39 EST
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@xxxxxxxx>
---
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