aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjorn Andersson <[email protected]>2018-06-26 07:11:56 -0500
committerBjorn Andersson <[email protected]>2018-06-26 13:53:06 -0700
commitbe37b1e0fb100a369cfb7ebf016491dfb6c71987 (patch)
tree360bbd42f51cba5e7b472745b975d48e838f4002
parent618fcff3742b4c62fea24bea1f01a2f002ed4b37 (diff)
remoteproc: Make start and stop in subdev optional
Some subdevices, such as glink ssr only care about the stop operation, so make the operations optional to reduce client code. Tested-by: Fabien Dessenne <[email protected]> Signed-off-by: Bjorn Andersson <[email protected]> Signed-off-by Alex Elder <[email protected]> Signed-off-by: Bjorn Andersson <[email protected]>
-rw-r--r--drivers/remoteproc/remoteproc_core.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
index 5dd58e6bea88..981ae6dff145 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -780,16 +780,20 @@ static int rproc_start_subdevices(struct rproc *rproc)
int ret;
list_for_each_entry(subdev, &rproc->subdevs, node) {
- ret = subdev->start(subdev);
- if (ret)
- goto unroll_registration;
+ if (subdev->start) {
+ ret = subdev->start(subdev);
+ if (ret)
+ goto unroll_registration;
+ }
}
return 0;
unroll_registration:
- list_for_each_entry_continue_reverse(subdev, &rproc->subdevs, node)
- subdev->stop(subdev, true);
+ list_for_each_entry_continue_reverse(subdev, &rproc->subdevs, node) {
+ if (subdev->stop)
+ subdev->stop(subdev, true);
+ }
return ret;
}
@@ -798,8 +802,10 @@ static void rproc_stop_subdevices(struct rproc *rproc, bool crashed)
{
struct rproc_subdev *subdev;
- list_for_each_entry_reverse(subdev, &rproc->subdevs, node)
- subdev->stop(subdev, crashed);
+ list_for_each_entry_reverse(subdev, &rproc->subdevs, node) {
+ if (subdev->stop)
+ subdev->stop(subdev, crashed);
+ }
}
/**