[RFC LINUX PATCH 04/19] remoteproc: sysfs: Add running independent state
From: Wendy Liang
Date: Fri Mar 24 2017 - 15:33:06 EST
From: Wendy Liang <wendy.liang@xxxxxxxxxx>
Show running independent state to indicate the remote
runs and it is not started by the remoteproc driver.
Signed-off-by: Wendy Liang <jliang@xxxxxxxxxx>
Signed-off-by: Michal Simek <michal.simek@xxxxxxxxxx>
---
drivers/remoteproc/remoteproc_sysfs.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
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);
--
1.9.1