]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
remoteproc: Make start and stop in subdev optional
authorBjorn Andersson <bjorn.andersson@linaro.org>
Tue, 26 Jun 2018 12:11:56 +0000 (07:11 -0500)
committerBjorn Andersson <bjorn.andersson@linaro.org>
Tue, 26 Jun 2018 20:53:06 +0000 (13:53 -0700)
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 <fabien.dessenne@st.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by Alex Elder <elder@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
drivers/remoteproc/remoteproc_core.c

index 5dd58e6bea88053e358be3cd1436b1a4d8f268de..981ae6dff145504c6ebabe5b32454f17a3d80e2d 100644 (file)
@@ -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);
+       }
 }
 
 /**