Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1391784pxf; Fri, 12 Mar 2021 08:28:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJy7f6jn+KWYHAmg40pTZjok4XBuKheofrVXRp+h5vMyul1W1C0FrGGKk0oKxIFhCwL5tQZq X-Received: by 2002:a17:906:260a:: with SMTP id h10mr9595833ejc.392.1615566538290; Fri, 12 Mar 2021 08:28:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615566538; cv=none; d=google.com; s=arc-20160816; b=BCyZQZcp1LUxu9mv16dnT39WZryo35mVyBsY8YlPOstqFLU03B1QiQFI+fyjEDOkHw RiusVmRWS+vcVPIluUa0MYPOzTP9q+4oeegqa5J9ZW7x893fmdejcpH6qqi/clTcaaLi s7/+GcKYQprU2OOrqx+CgRhiiYcL+/pBBKq1CLrRN0QrYc034WuCWy9itCZDFt173A4O JIY8jyoSiNVl285LTUcnAKcuSNNLqH3kpL0adDeEZy22F91qzJ6HQZUNblqe1XEPff4d uj+Iqb71GDjPjQ5M+L44yJ1CnpZPT7bbRIoKgGQceP+D/xMj17KBsCCjaxy0GyYfYtRp Tkrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=gj6WF/1oKuVocPkZDr0q35lcZZqhgtjB+hq21nBtWDQ=; b=Nq7k/VzHJSbAM7gV5BoK4iGLAQeRRhL4OlqSwH63oS/yRKeCcGBhmcoCEBA58+/Vkm CB0tmlBm4Yqh/8kxBZ+Of2JxSLehzecROzCpKuKPAXoxIqYvryKtFlXt1Bu/LoS/Jhj5 kO6/Bv7cdDpbJyoF31NtL6Pi347VMEj028ygICQT/r1Qxt/Hp3q/Vqmtwx4yBQ/tCemE Tqc7TSUGg9hScvo7f5KkpToOj5H8t0CDyKWSek3Js7J0zlpLS8buwbgwnMHbEvd6hO35 SDtG0lZwo+9va2PFD/QIaF4j7uMJ5zkozS585zhJE01uucsWM4PaKpqC6BbfB3FDo1l3 cfaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gtz428PB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lf1si4613031ejc.433.2021.03.12.08.28.35; Fri, 12 Mar 2021 08:28:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gtz428PB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232964AbhCLQZu (ORCPT + 99 others); Fri, 12 Mar 2021 11:25:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232501AbhCLQZM (ORCPT ); Fri, 12 Mar 2021 11:25:12 -0500 Received: from mail-pg1-x531.google.com (mail-pg1-x531.google.com [IPv6:2607:f8b0:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7581C061761 for ; Fri, 12 Mar 2021 08:25:11 -0800 (PST) Received: by mail-pg1-x531.google.com with SMTP id t26so16197006pgv.3 for ; Fri, 12 Mar 2021 08:25:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gj6WF/1oKuVocPkZDr0q35lcZZqhgtjB+hq21nBtWDQ=; b=gtz428PBLEgDloxKNuUGPr92ilupj59j2EfFWY0/N6WmAnATRxpQJlW+J2ee8AQHav xfm/Xf2HxlRVeNugLHL+U4NK/rWK5UJwdN7EfSosWKr3Zt4TBkWgoN5gxNkvHYyl37ew wTLuoegWNmHdbT1yapt1sRmrpbJFDYR80XDVQgf9zEXVpRYxrykMcKshqEyybiNI1g/+ jIPrVankCXpF2yQKIzgKc3SRrrvlTrz2bdl5FITvFh/l09kH6c8OChMhbgTMBAroPgIq dRrowcFVCygaFx/jN2st9jMIN6PuKz34cElkxvTGRjMivbDKekwO6IJqP8vq2Scn2hAs yumw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gj6WF/1oKuVocPkZDr0q35lcZZqhgtjB+hq21nBtWDQ=; b=TaZIWbUZTniOSxsPNyiXQQ24GjMYQ24VFz8d+swCw5sJByANWHprBjPGxN3MlgewoD pOmAARcLfDer2vV3kDGA0Bppqcg6shqNm1keES6vWgQicjHnVj6cYvtof314glUnAqVb GLnjO4ze2ZXm2XW6cWMG/FZvEUnKfAEHIR5hat5jew5XQYziQPfDfZlFID7MyalslXHf kNb30LMJeRKd8pMB85ywwDFtpZLn2JyfQ4clcubBy9y2r8iqJmvssXyPiSwM+SsX2o2T tzSXlZBco6IjlldQJdNagGlyVulkwnq37mihvkRIjanAoVrIqpCFOsPe9ArI1cyGc9ii asuQ== X-Gm-Message-State: AOAM531gsxkgI2jVjSZ1csF9zmP+ZYnFSk34CbzwxCQy6B5+R9LvYh50 Sw/dk3C3w0PR9tUfh3scYCPNAg== X-Received: by 2002:a63:135e:: with SMTP id 30mr12705562pgt.6.1615566311426; Fri, 12 Mar 2021 08:25:11 -0800 (PST) Received: from xps15.cg.shawcable.net (S0106889e681aac74.cg.shawcable.net. [68.147.0.187]) by smtp.gmail.com with ESMTPSA id e8sm5899599pgb.35.2021.03.12.08.25.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Mar 2021 08:25:11 -0800 (PST) From: Mathieu Poirier To: bjorn.andersson@linaro.org, ohad@wizery.com Cc: arnaud.pouliquen@st.com, mcoquelin.stm32@gmail.com, alexandre.torgue@st.com, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v8 14/17] remoteproc: Properly deal with a start request when attached Date: Fri, 12 Mar 2021 09:24:50 -0700 Message-Id: <20210312162453.1234145-15-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210312162453.1234145-1-mathieu.poirier@linaro.org> References: <20210312162453.1234145-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch takes into account scenarios where a remote processor has been attached to when receiving a "start" command from sysfs. As with the case with the running state, the command can't be carried out if the remote processor is already in operation. Signed-off-by: Mathieu Poirier Reviewed-by: Arnaud Pouliquen --- drivers/remoteproc/remoteproc_cdev.c | 3 ++- drivers/remoteproc/remoteproc_sysfs.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/remoteproc/remoteproc_cdev.c b/drivers/remoteproc/remoteproc_cdev.c index b19ea3057bde..b2cee9afb41b 100644 --- a/drivers/remoteproc/remoteproc_cdev.c +++ b/drivers/remoteproc/remoteproc_cdev.c @@ -32,7 +32,8 @@ static ssize_t rproc_cdev_write(struct file *filp, const char __user *buf, size_ return -EFAULT; if (!strncmp(cmd, "start", len)) { - if (rproc->state == RPROC_RUNNING) + if (rproc->state == RPROC_RUNNING || + rproc->state == RPROC_ATTACHED) return -EBUSY; ret = rproc_boot(rproc); diff --git a/drivers/remoteproc/remoteproc_sysfs.c b/drivers/remoteproc/remoteproc_sysfs.c index f9694def9b54..66801e6fe5cd 100644 --- a/drivers/remoteproc/remoteproc_sysfs.c +++ b/drivers/remoteproc/remoteproc_sysfs.c @@ -194,7 +194,8 @@ 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_ATTACHED) return -EBUSY; ret = rproc_boot(rproc); -- 2.25.1