]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - rpmsg/remoteproc.git/commitdiff
remoteproc: Fix sysfs interface to stop a suspended processor
authorJ, KEERTHY <j-keerthy@ti.com>
Wed, 15 Feb 2017 11:59:25 +0000 (11:59 +0000)
committerSuman Anna <s-anna@ti.com>
Mon, 4 Mar 2019 16:17:26 +0000 (10:17 -0600)
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>
drivers/remoteproc/remoteproc_sysfs.c

index 6b7e8b2b43be0753ba55296d1ada1b5525c53fc8..0c47bc0bb36a585547d051848a4f8722e411d2c8 100644 (file)
@@ -100,7 +100,8 @@ static ssize_t state_store(struct device *dev,
                                module_put(dev->parent->driver->owner);
                }
        } else if (sysfs_streq(buf, "stop")) {
-               if (rproc->state != RPROC_RUNNING)
+               if (rproc->state != RPROC_RUNNING &&
+                   rproc->state != RPROC_SUSPENDED)
                        return -EINVAL;
 
                rproc_shutdown(rproc);