Received: by 10.192.165.148 with SMTP id m20csp714636imm; Wed, 25 Apr 2018 06:38:16 -0700 (PDT) X-Google-Smtp-Source: AIpwx48t6dGNrwcIQp4zjLNIKv3S6X/9Y6cJ2wXG6dh2mQnY7O2MEwzcg4i02As+LmVZubeUDVJ9 X-Received: by 10.98.141.65 with SMTP id z62mr28178009pfd.144.1524663496926; Wed, 25 Apr 2018 06:38:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524663496; cv=none; d=google.com; s=arc-20160816; b=kvWGsQFUhibCbnFQYF+gnKXMGajjruqEtr2jZWD5e69n+BaRz47DRf2L0fIQZoNEI+ zl0s96iMvlD9Mw9uvRQWHhbGQP3ViDfF12ppjUQnrcau1l4ipbup4w9vDZONA+H9xWno dsBaAJAW0az+4SLl4i2S+SEavqw6VzjfD9UEQAJa6MbACmwMuInhii9RTuA+FbB/1rHj BdnaKPHJR9jQ/LW5uXIBuAtFw06IwzmCjKHjlJzMqrsYUdZvuCXPmVJYHT0u9pdbw2AA c6Z/K13sBOfaqPn9P+dN0fTh5uBmpuI+tL+dLa7U4KSK689sfpIqjm6hbIdICYiX71Sk qXZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=IWHqWMLTIEUsBjVcBY5HDZ8SbGAEG8A+2VFh4uHxtsk=; b=Yp32GebrwerLwWR+n769OQ6nA1dVJFJO46VWhuCEbg0r7iFmrz7giKWvTgoXMr9MYZ yot3nL3yi/R0ShxkYEcrFU9qRLdKm0oIOu24TGyuh/xKEETdxXSLloYQRY+dUzBBDmX8 R8bxXHhLrRuxf68ka4dJAWioDRyj90AhfU8ky+Z8hqJijovF8v6S+DS+V7zBaZg+myqV 3HYnmChdOdaUzqjqLmu2mb180jlpiBiMHlXEKj1AOW0vLMsBOLPdSvjWkU0bgCnwHgxX QVq9V2zzb1q1LznDvPJCnyGMdXgyF8PrEZCEZ9Cz5BYBApNojYe0no6b1B/7PbyZavy5 +m2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aTawgygG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id b3-v6si3819940plc.329.2018.04.25.06.38.01; Wed, 25 Apr 2018 06:38:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aTawgygG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1754240AbeDYNgx (ORCPT + 99 others); Wed, 25 Apr 2018 09:36:53 -0400 Received: from mail-it0-f65.google.com ([209.85.214.65]:40067 "EHLO mail-it0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753327AbeDYNgu (ORCPT ); Wed, 25 Apr 2018 09:36:50 -0400 Received: by mail-it0-f65.google.com with SMTP id u62-v6so19346054ita.5 for ; Wed, 25 Apr 2018 06:36:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=IWHqWMLTIEUsBjVcBY5HDZ8SbGAEG8A+2VFh4uHxtsk=; b=aTawgygGl+Dk2rEzwYwmP7lEI9d5Kht8xLoAKZlQXSEnJVR/HDhzB4XOVDUGmnB6Pa t/4adMfZSqczsrrEKRatFhDfJWPDhuRqntLqLsn0tSdMiD2Tr323yC0jt7dGmjbegNa/ Yii5tspOp4h4GMYBQAy9RC+gpKwy1CcpWfs3I= 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; bh=IWHqWMLTIEUsBjVcBY5HDZ8SbGAEG8A+2VFh4uHxtsk=; b=M4WhYpm6pPz95/ASRMm4KHrsi3b32GIpzYSLo29jCmID9FNq0KKSXJsmwK6Mu4ah9Q jm1UgdMUlGtzwqRY49jS0J2b5SGUnSFWwL0q4osVoz64kZG9JHLgajvk48kWNtSphsC3 TqIgDkX1q7Shsoyciit0zGCqD10tIMAQNWKeE8zM3prBmqBNuE+76SLYrp+8AfF8FtYn +pJ1MLGpYHp4L9V+vzHqOzVi/wGkwKSNP6Pl3D7vTaJs+ffRMbTOpPq47tap9f1+GgMp ld54A7lJcyrVlVWGkhkt70sUn8tFypfAkX2KZUYVE2NmriXIMX7oMB8p8idrl8QZTPp/ VrWg== X-Gm-Message-State: ALQs6tAyZiCbr33webd8ZmQHFBBmUF68654v6LP8jgYA59/3YtLV5ffX BPZgOMtcdACPsIyjG2aqT5KHOw== X-Received: by 2002:a24:7958:: with SMTP id z85-v6mr6818100itc.137.1524663409817; Wed, 25 Apr 2018 06:36:49 -0700 (PDT) Received: from localhost.localdomain (c-71-195-29-92.hsd1.mn.comcast.net. [71.195.29.92]) by smtp.gmail.com with ESMTPSA id 85-v6sm2530126ioj.48.2018.04.25.06.36.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Apr 2018 06:36:49 -0700 (PDT) From: Alex Elder To: ohad@wizery.com, bjorn.andersson@linaro.org Cc: linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] remoteproc: rename "crashed" parameter Date: Wed, 25 Apr 2018 08:36:26 -0500 Message-Id: <20180425133626.11781-1-elder@linaro.org> X-Mailer: git-send-email 2.14.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The last commit to "remoteproc_core.c": 880f5b388252 remoteproc: Pass type of shutdown to subdev remove added a Boolean flag to the subdevice remove method, to distinguish between graceful shutdown and a crash. Unfortunately, the names of the parameters were inconsistent, and in fact have opposite meanings. In most cases, the parameter is named "crashed", but rproc_add_subdev() names the parameter "graceful" in the prototype for the remove method. The remove method is ultimately called (and supplied with the Boolean flag value) by rproc_remove_subdevices(). That is only called by rproc_stop(), and in the two spots where that is used, "graceful" is the right name for the flag: rproc_shutdown() passes true, indicating a graceful shutdown rproc_trigger_recovery() passes false, indicating a crash The fix is to make the parameter name consistent, and making the name and sense of the parameter to always be "crashed" produces the smallest change. So that's what this patch does. To verify this change, rproc_add_subdev() is called in five spots: - qcom_add_glink_subdev() passes glink_subdev_remove() - qcom_add_smd_subdev() passes smd_subdev_remove() - qcom_add_ssr_subdev() passes ssr_notify_stop() - qcom_add_sysmon_subdev() passes sysmon_stop() - rproc_handle_vdev() passes rproc_vdev_do_remove() Of these, only sysmon_stop() uses its "crashed" parameter. And it clearly assumes that "crashed" is the intended meaning: /* Don't request graceful shutdown if we've crashed */ if (crashed) return; So this function (added after the "crashed" parameter was added) exhibited buggy behavior, which is now fixed by this patch. Signed-off-by: Alex Elder --- drivers/remoteproc/remoteproc_core.c | 4 ++-- include/linux/remoteproc.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index 6d9c5832ce47..a9609d971f7f 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -1163,7 +1163,7 @@ int rproc_trigger_recovery(struct rproc *rproc) if (ret) return ret; - ret = rproc_stop(rproc, false); + ret = rproc_stop(rproc, true); if (ret) goto unlock_mutex; @@ -1316,7 +1316,7 @@ void rproc_shutdown(struct rproc *rproc) if (!atomic_dec_and_test(&rproc->power)) goto out; - ret = rproc_stop(rproc, true); + ret = rproc_stop(rproc, false); if (ret) { atomic_inc(&rproc->power); goto out; diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h index d09a9c7af109..dfdaede9139e 100644 --- a/include/linux/remoteproc.h +++ b/include/linux/remoteproc.h @@ -569,7 +569,7 @@ static inline struct rproc *vdev_to_rproc(struct virtio_device *vdev) void rproc_add_subdev(struct rproc *rproc, struct rproc_subdev *subdev, int (*probe)(struct rproc_subdev *subdev), - void (*remove)(struct rproc_subdev *subdev, bool graceful)); + void (*remove)(struct rproc_subdev *subdev, bool crashed)); void rproc_remove_subdev(struct rproc *rproc, struct rproc_subdev *subdev); -- 2.14.1