summaryrefslogtreecommitdiff
path: root/drivers/remoteproc
diff options
context:
space:
mode:
authorArnaud Pouliquen <arnaud.pouliquen@foss.st.com>2022-09-21 16:50:42 +0300
committerMathieu Poirier <mathieu.poirier@linaro.org>2022-09-21 20:14:17 +0300
commit63badba9457147b64dbd4680518a810456eeed0c (patch)
treefa0a6169bfc3ea70c00d49b5006505e79ed8da66 /drivers/remoteproc
parentfd28f879e6274d477378362d848b42747ecb27eb (diff)
downloadlinux-63badba9457147b64dbd4680518a810456eeed0c.tar.xz
remoteproc: core: Introduce rproc_add_rvdev function
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 function), introduce the rproc_add_rvdev and rproc_remove_rvdev functions. Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com> Link: https://lore.kernel.org/r/20220921135044.917140-3-arnaud.pouliquen@foss.st.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Diffstat (limited to 'drivers/remoteproc')
-rw-r--r--drivers/remoteproc/remoteproc_core.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
index f8dd8c526299..ddf2c716d7d8 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -486,6 +486,18 @@ static int copy_dma_range_map(struct device *to, struct device *from)
return 0;
}
+static void rproc_add_rvdev(struct rproc *rproc, struct rproc_vdev *rvdev)
+{
+ if (rvdev && rproc)
+ list_add_tail(&rvdev->node, &rproc->rvdevs);
+}
+
+static void rproc_remove_rvdev(struct rproc_vdev *rvdev)
+{
+ if (rvdev)
+ list_del(&rvdev->node);
+}
+
static struct rproc_vdev *
rproc_rvdev_add_device(struct rproc *rproc, struct rproc_vdev_data *rvdev_data)
{
@@ -549,7 +561,7 @@ rproc_rvdev_add_device(struct rproc *rproc, struct rproc_vdev_data *rvdev_data)
goto unwind_vring_allocations;
}
- list_add_tail(&rvdev->node, &rproc->rvdevs);
+ rproc_add_rvdev(rproc, rvdev);
rvdev->subdev.start = rproc_vdev_do_start;
rvdev->subdev.stop = rproc_vdev_do_stop;
@@ -579,7 +591,7 @@ void rproc_vdev_release(struct kref *ref)
}
rproc_remove_subdev(rproc, &rvdev->subdev);
- list_del(&rvdev->node);
+ rproc_remove_rvdev(rvdev);
device_unregister(&rvdev->dev);
}