diff mbox

[RFC,LINUX,04/19] remoteproc: sysfs: Add running independent state

Message ID 1490383355-23176-5-git-send-email-jliang@xilinx.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jiaying Liang March 24, 2017, 7:22 p.m. UTC
From: Wendy Liang <wendy.liang@xilinx.com>

Show running independent state to indicate the remote
runs and it is not started by the remoteproc driver.

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

Patch

diff --git a/drivers/remoteproc/remoteproc_sysfs.c b/drivers/remoteproc/remoteproc_sysfs.c
index 47be411..616057d 100644
--- a/drivers/remoteproc/remoteproc_sysfs.c
+++ b/drivers/remoteproc/remoteproc_sysfs.c
@@ -74,6 +74,7 @@  static ssize_t firmware_store(struct device *dev,
 	[RPROC_RUNNING]		= "running",
 	[RPROC_CRASHED]		= "crashed",
 	[RPROC_DELETED]		= "deleted",
+	[RPROC_RUNNING_INDEPENDENT] = "running_independent",
 	[RPROC_LAST]		= "invalid",
 };
 
@@ -97,14 +98,16 @@  static ssize_t state_store(struct device *dev,
 	int ret = 0;
 
 	if (sysfs_streq(buf, "start")) {
-		if (rproc->state == RPROC_RUNNING)
+		if (rproc->state == RPROC_RUNNING ||
+			rproc->state == RPROC_RUNNING_INDEPENDENT)
 			return -EBUSY;
 
 		ret = rproc_boot(rproc);
 		if (ret)
 			dev_err(&rproc->dev, "Boot failed: %d\n", ret);
 	} else if (sysfs_streq(buf, "stop")) {
-		if (rproc->state != RPROC_RUNNING)
+		if (rproc->state != RPROC_RUNNING &&
+			rproc->state != RPROC_RUNNING_INDEPENDENT)
 			return -EINVAL;
 
 		rproc_shutdown(rproc);