From patchwork Wed Apr 25 13:36:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 10363255 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0E7D26038F for ; Wed, 25 Apr 2018 13:36:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F236027CAF for ; Wed, 25 Apr 2018 13:36:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E6E2227E63; Wed, 25 Apr 2018 13:36:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5ECBE27CAF for ; Wed, 25 Apr 2018 13:36:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753327AbeDYNgx (ORCPT ); Wed, 25 Apr 2018 09:36:53 -0400 Received: from mail-it0-f67.google.com ([209.85.214.67]:55728 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754130AbeDYNgv (ORCPT ); Wed, 25 Apr 2018 09:36:51 -0400 Received: by mail-it0-f67.google.com with SMTP id 144-v6so5296276iti.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=BXFrrlSkWR2SjhQ1fe55SUb/KWIvsrOdalunvIFJqCrgNFs/MnWMKcgn7dToqmWT5v AomlR5/Kyw8ey8v4jl2REx/uQTzCR/mJXrYb3/t4XJ9Pma1/FgXu8JOgVLLSj9or7Tdp rKG/mHxbVergMcN44CSp178OdJFqnjFjLgyQvNCfAYGGdiK1iFB7vz4JKgmTakrRSLWF j+sh+2ZigYZkm2PyfK9IkQlApUcpZLLvicGWKWBlzqkJD3ubKHWQF2CUT4GGvF920oE6 n07yjplrH3M7BdLj1Uo2lfugOYKm3t0Wk7gggVmX4A1tuwQGjuhek42RHWpwJpjXibRt wwNQ== X-Gm-Message-State: ALQs6tD2oTRVdh9WYBDrj/0Myf4VCIRCO9QwfJXY0H4DTFAqMK4nMMmq SMGI51FJgPQrE7Isobs52DrqqQ== X-Google-Smtp-Source: AB8JxZoP0gOD1MnVTQwdNtKejYeQV5HSOuskjnSA8Gx9i1MbfqUi8/noOhLAVbdHcNwvQ/u7jxEk0Q== 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-remoteproc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Acked-by: Alex Elder Reviewed-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);