aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJ, KEERTHY2017-02-15 05:59:25 -0600
committerSuman Anna2019-03-04 10:17:26 -0600
commitcb6320f7002078445ba5cebb5cdefca75136e052 (patch)
treed668bc69ed6fcb4b00c7246152ac478fdb3184ea
parent7405d551db8e9153e1467839d40a901b744109a4 (diff)
downloadremoteproc-cb6320f7002078445ba5cebb5cdefca75136e052.tar.gz
remoteproc-cb6320f7002078445ba5cebb5cdefca75136e052.tar.xz
remoteproc-cb6320f7002078445ba5cebb5cdefca75136e052.zip
remoteproc: Fix sysfs interface to stop a suspended processor
Commit 2aefbef04149 ("remoteproc: Add a sysfs interface for firmware and state") has added an interface to be able to stop a remote processor, change the firmware and start the remote processor using the new firmware through the sysfs files 'state' and 'firmware'. Any firmware change requires the processor to be in a stopped state. The logic in 'stop' checks for a valid state (RPROC_RUNNING) before a processor can be stopped. A booted remote processor though can also be in RPROC_SUSPENDED state if the driver controlling the device supports runtime auto-suspend, and any attempt to stop such a processor throws an error, "write error: Invalid argument". It should be possible to stop a processor that is in suspended state using the sysfs entry, as this is a perfectly functional scenario when either removing the module, or unbinding the device from the driver. Fix the sysfs logic to permit the same. Signed-off-by: Keerthy <j-keerthy@ti.com> Signed-off-by: Suman Anna <s-anna@ti.com>
-rw-r--r--drivers/remoteproc/remoteproc_sysfs.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/remoteproc/remoteproc_sysfs.c b/drivers/remoteproc/remoteproc_sysfs.c
index 6b7e8b2b43be..0c47bc0bb36a 100644
--- a/drivers/remoteproc/remoteproc_sysfs.c
+++ b/drivers/remoteproc/remoteproc_sysfs.c
@@ -100,7 +100,8 @@ static ssize_t state_store(struct device *dev,
100 module_put(dev->parent->driver->owner); 100 module_put(dev->parent->driver->owner);
101 } 101 }
102 } else if (sysfs_streq(buf, "stop")) { 102 } else if (sysfs_streq(buf, "stop")) {
103 if (rproc->state != RPROC_RUNNING) 103 if (rproc->state != RPROC_RUNNING &&
104 rproc->state != RPROC_SUSPENDED)
104 return -EINVAL; 105 return -EINVAL;
105 106
106 rproc_shutdown(rproc); 107 rproc_shutdown(rproc);