From: Alex Elder <elder@linaro.org>
To: ohad@wizery.com, bjorn.andersson@linaro.org
Cc: linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 2/5] remoteproc: Make start and stop in subdev optional
Date: Tue, 26 Jun 2018 07:11:56 -0500 [thread overview]
Message-ID: <20180626121159.7267-3-elder@linaro.org> (raw)
In-Reply-To: <20180626121159.7267-1-elder@linaro.org>
From: Bjorn Andersson <bjorn.andersson@linaro.org>
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>
---
drivers/remoteproc/remoteproc_core.c | 20 +++++++++++++-------
1 file 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);
+ }
}
/**
--
2.17.1
next prev parent reply other threads:[~2018-06-26 12:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-26 12:11 [PATCH v2 0/5] remoteproc: updates for new events Alex Elder
2018-06-26 12:11 ` [PATCH v2 1/5] remoteproc: Rename subdev functions to start/stop Alex Elder
2018-06-26 12:11 ` Alex Elder [this message]
2018-06-26 12:11 ` [PATCH v2 3/5] remoteproc: Make client initialize ops in rproc_subdev Alex Elder
2018-06-26 12:11 ` [PATCH v2 4/5] remoteproc: rename subdev probe and remove functions Alex Elder
2018-06-26 12:11 ` [PATCH v2 5/5] remoteproc: Introduce prepare and unprepare for subdevices Alex Elder
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=20180626121159.7267-3-elder@linaro.org \
--to=elder@linaro.org \
--cc=bjorn.andersson@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=ohad@wizery.com \
/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;
as well as URLs for NNTP newsgroup(s).