summaryrefslogtreecommitdiff
path: root/drivers/remoteproc/remoteproc_cdev.c
diff options
context:
space:
mode:
authorMathieu Poirier <mathieu.poirier@linaro.org>2021-03-12 09:24:52 -0700
committerBjorn Andersson <bjorn.andersson@linaro.org>2021-03-18 08:02:10 -0500
commit5daaeb5f07ed0681b734864dde58dcadab115963 (patch)
tree9e35bf520f71d93a47ec6cb0b356341327a4e3e0 /drivers/remoteproc/remoteproc_cdev.c
parentd2008a96833082713094ba8a545141be1b01b266 (diff)
remoteproc: Properly deal with a detach request when attached
This patch introduces the capability to detach a remote processor that has been attached to by the remoteproc core. For that to happen a rproc::ops::detach() operation needs to be available. Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Reviewed-by: Arnaud Pouliquen <arnaud.pouliquen@st.com> Link: https://lore.kernel.org/r/20210312162453.1234145-17-mathieu.poirier@linaro.org Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Diffstat (limited to 'drivers/remoteproc/remoteproc_cdev.c')
-rw-r--r--drivers/remoteproc/remoteproc_cdev.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/remoteproc/remoteproc_cdev.c b/drivers/remoteproc/remoteproc_cdev.c
index 0249d8f6c3f8..2db494816d5f 100644
--- a/drivers/remoteproc/remoteproc_cdev.c
+++ b/drivers/remoteproc/remoteproc_cdev.c
@@ -43,6 +43,11 @@ static ssize_t rproc_cdev_write(struct file *filp, const char __user *buf, size_
return -EINVAL;
rproc_shutdown(rproc);
+ } else if (!strncmp(cmd, "detach", len)) {
+ if (rproc->state != RPROC_ATTACHED)
+ return -EINVAL;
+
+ ret = rproc_detach(rproc);
} else {
dev_err(&rproc->dev, "Unrecognized option\n");
ret = -EINVAL;