All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wendy Liang <wendy.liang@xilinx.com>
To: bjorn.andersson@linaro.org
Cc: linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Wendy Liang  <wendy.liang@xilinx.com>,
	Wendy Liang <jliang@xilinx.com>,
	Michal Simek" <michal.simek@xilinx.com>
Subject: [RFC LINUX PATCH 18/19] remoteproc: shutdown: set state to OFFLINE after stopping remote
Date: Fri, 24 Mar 2017 12:22:34 -0700	[thread overview]
Message-ID: <1490383355-23176-19-git-send-email-jliang@xilinx.com> (raw)
In-Reply-To: <1490383355-23176-1-git-send-email-jliang@xilinx.com>

From: Wendy Liang <wendy.liang@xilinx.com>

Set rproc state to OFFLINE right after it stops the remote.
Some remoteproc virtio operations depends on rproc state. And thus,
we should set the rproc state to OFFLINE right after it stops
the remote.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---
 drivers/remoteproc/remoteproc_core.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
index ffd1de2..62c0356 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -1369,6 +1369,7 @@ void rproc_shutdown(struct rproc *rproc)
 {
 	struct device *dev = &rproc->dev;
 	int ret;
+	int pre_rproc_state;
 
 	ret = mutex_lock_interruptible(&rproc->lock);
 	if (ret) {
@@ -1391,6 +1392,9 @@ void rproc_shutdown(struct rproc *rproc)
 		goto out;
 	}
 
+	pre_rproc_state = rproc->state;
+	rproc->state = RPROC_OFFLINE;
+
 	/* clean up all acquired resources */
 	rproc_resource_cleanup(rproc);
 
@@ -1402,11 +1406,9 @@ void rproc_shutdown(struct rproc *rproc)
 	rproc->table_ptr = NULL;
 
 	/* if in crash state, unlock crash handler */
-	if (rproc->state == RPROC_CRASHED)
+	if (pre_rproc_state == RPROC_CRASHED)
 		complete_all(&rproc->crash_comp);
 
-	rproc->state = RPROC_OFFLINE;
-
 	dev_info(dev, "stopped remote processor %s\n", rproc->name);
 
 out:
-- 
1.9.1

WARNING: multiple messages have this Message-ID (diff)
From: Wendy Liang <wendy.liang@xilinx.com>
To: <bjorn.andersson@linaro.org>
Cc: <linux-remoteproc@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,
	"Wendy Liang" <wendy.liang@xilinx.com>,
	Wendy Liang <jliang@xilinx.com>,
	Michal Simek <michal.simek@xilinx.com>
Subject: [RFC LINUX PATCH 18/19] remoteproc: shutdown: set state to OFFLINE after stopping remote
Date: Fri, 24 Mar 2017 12:22:34 -0700	[thread overview]
Message-ID: <1490383355-23176-19-git-send-email-jliang@xilinx.com> (raw)
In-Reply-To: <1490383355-23176-1-git-send-email-jliang@xilinx.com>

From: Wendy Liang <wendy.liang@xilinx.com>

Set rproc state to OFFLINE right after it stops the remote.
Some remoteproc virtio operations depends on rproc state. And thus,
we should set the rproc state to OFFLINE right after it stops
the remote.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---
 drivers/remoteproc/remoteproc_core.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
index ffd1de2..62c0356 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -1369,6 +1369,7 @@ void rproc_shutdown(struct rproc *rproc)
 {
 	struct device *dev = &rproc->dev;
 	int ret;
+	int pre_rproc_state;
 
 	ret = mutex_lock_interruptible(&rproc->lock);
 	if (ret) {
@@ -1391,6 +1392,9 @@ void rproc_shutdown(struct rproc *rproc)
 		goto out;
 	}
 
+	pre_rproc_state = rproc->state;
+	rproc->state = RPROC_OFFLINE;
+
 	/* clean up all acquired resources */
 	rproc_resource_cleanup(rproc);
 
@@ -1402,11 +1406,9 @@ void rproc_shutdown(struct rproc *rproc)
 	rproc->table_ptr = NULL;
 
 	/* if in crash state, unlock crash handler */
-	if (rproc->state == RPROC_CRASHED)
+	if (pre_rproc_state == RPROC_CRASHED)
 		complete_all(&rproc->crash_comp);
 
-	rproc->state = RPROC_OFFLINE;
-
 	dev_info(dev, "stopped remote processor %s\n", rproc->name);
 
 out:
-- 
1.9.1

  parent reply	other threads:[~2017-03-24 19:22 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-24 19:22 [RFC LINUX PATCH 00/19] Allow master to restart without restarting slave Wendy Liang
2017-03-24 19:22 ` Wendy Liang
2017-03-24 19:22 ` [RFC LINUX PATCH 01/19] remoteproc: Add is_runinng to remoteproc ops Wendy Liang
2017-03-24 19:22   ` Wendy Liang
2017-03-24 19:22 ` [RFC LINUX PATCH 02/19] remtoeproc: Add an operation to check if remote is running Wendy Liang
2017-03-24 19:22   ` Wendy Liang
2017-03-24 19:22 ` [RFC LINUX PATCH 03/19] remoteproc: Add a running independent state Wendy Liang
2017-03-24 19:22   ` Wendy Liang
2017-03-24 19:22 ` [RFC LINUX PATCH 04/19] remoteproc: sysfs: Add " Wendy Liang
2017-03-24 19:22   ` Wendy Liang
2017-03-24 19:22 ` [RFC LINUX PATCH 05/19] remoteproc: check if remote is running the fw before reload fw Wendy Liang
2017-03-24 19:22   ` Wendy Liang
2017-03-24 19:22 ` [RFC LINUX PATCH 06/19] remoteproc: elf loader: Add get checksum firmware implementation Wendy Liang
2017-03-24 19:22   ` Wendy Liang
2017-03-24 19:22 ` [RFC LINUX PATCH 07/19] remoteproc: Add firmware checksum resource entry Wendy Liang
2017-03-24 19:22   ` Wendy Liang
2017-03-24 19:22 ` [RFC LINUX PATCH 08/19] remoteproc: add a function to set fw checksum rsc Wendy Liang
2017-03-24 19:22   ` Wendy Liang
2017-03-24 19:22 ` [RFC LINUX PATCH 09/19] remoteproc: check firmware checksum in rproc_is_running_fw() Wendy Liang
2017-03-24 19:22   ` Wendy Liang
2017-03-24 19:22 ` [RFC LINUX PATCH 10/19] remoteproc: Add rproc resource with id struct Wendy Liang
2017-03-24 19:22   ` Wendy Liang
2017-03-24 19:22 ` [RFC LINUX PATCH 11/19] remoteproc: Add rproc_idr_alloc/remove wrapper Wendy Liang
2017-03-24 19:22   ` Wendy Liang
2017-03-24 19:22 ` [RFC LINUX PATCH 12/19] remoteproc: use rproc_id_rsc for data got from idr_find() Wendy Liang
2017-03-24 19:22   ` Wendy Liang
2017-03-24 19:22 ` [RFC LINUX PATCH 13/19] remoteproc: add config_wait_complete to rproc_vdev Wendy Liang
2017-03-24 19:22   ` Wendy Liang
2017-03-24 19:22 ` [RFC LINUX PATCH 14/19] remoteproc virtio: handle rproc vdev notification Wendy Liang
2017-03-24 19:22   ` Wendy Liang
2017-03-24 19:22 ` [RFC LINUX PATCH 15/19] remoteproc: virtio: rename rproc_virtio_notify to rproc_vq_notify Wendy Liang
2017-03-24 19:22   ` Wendy Liang
2017-03-24 19:22 ` [RFC LINUX PATCH 16/19] remoteproc: virtio: use rproc_virtio_notify() to notify vdev changes Wendy Liang
2017-03-24 19:22   ` Wendy Liang
2017-03-24 19:22 ` [RFC LINUX PATCH 17/19] remoteproc: virtio: kick in reset virtio Wendy Liang
2017-03-24 19:22   ` Wendy Liang
2017-03-24 19:22 ` Wendy Liang [this message]
2017-03-24 19:22   ` [RFC LINUX PATCH 18/19] remoteproc: shutdown: set state to OFFLINE after stopping remote Wendy Liang
2017-03-24 19:22 ` [RFC LINUX PATCH 19/19] remoteproc: virtio: idr_alloc for rvdev Wendy Liang
2017-03-24 19:22   ` Wendy Liang

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=1490383355-23176-19-git-send-email-jliang@xilinx.com \
    --to=wendy.liang@xilinx.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=michal.simek@xilinx.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.