From patchwork Mon Oct 14 07:07:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\(Exiting\) Baolin Wang" X-Patchwork-Id: 176133 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp4141509ill; Mon, 14 Oct 2019 00:08:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqzC12YlCFTt59IdKoyfkwuUhVeneH+ds5PxpbcnOptKx2CeczlwsLELUrkQdTwrERyvNpIA X-Received: by 2002:a17:906:130c:: with SMTP id w12mr26585006ejb.142.1571036908013; Mon, 14 Oct 2019 00:08:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571036908; cv=none; d=google.com; s=arc-20160816; b=bxylKo78I9tkS1vK1TzaA/FV68aDoHR2e2K4t7IH2JpHFKIz+JSpAtwa+v58SX1yP+ gvf5KU5A6sWMqzU/OsEWyWLFlHNpbtrjfrYlMlXidbgRsEIQZ2PgHW6pRvBX1jqwEz1X 2Fj9Guv6qqykcYgGBAlVtTOsGuVrcNEke82ZODwCJ7Gyh17k9RzvqVnjpzlrXrv73otz 2i2Z/jP/6AuB5CP8VZejhpiSmr0y4CSgdRhdTdU6YxdCdgeGAhHjdD14+D6s47U8SJ53 wpc1EdvRj1yLeAt0ZLP/P0yfHm1mRrW3OeGtsDdBL4255eD4BVUOD00CoaaI4GoU7QBy gYBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=c0QsMwW5/HlkG+EyBzY3CChBE/BthJe1X9zmk8IUDUw=; b=ooC2kju3A0PkGQm4xSmDqju7b4jK7GPGDQ5LdNuwqzBMt4DaMCkbV7oA2b5RCx6vIx pdck4HOKA5BNCG8CGecSg5IpOCCUZcQT7O8wM/0bIXtfaXGfhVzoHAFVr93K2BTiUfKf 483p2GRgzo3yTBkJLEfs8JMF4xBPysW0zj78gikhMajEiIiVGBur7Wbsni54m3A45VwP TZBU6MmLpNRp9KQP94H2II4DTWqmoUKlYVNLw/zayo5rsjgegihBKEJrGL4qymcL9J4f HOcqGtgsMevj2WnzpdNV18XZhdniMLRm4J+1y9+CpC2islrYRf9kkAnb0EbIUjFyZAaf XZgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ro6DrO1F; 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 t18si10584853ejr.205.2019.10.14.00.08.27; Mon, 14 Oct 2019 00:08:28 -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=ro6DrO1F; 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 S1730286AbfJNHIZ (ORCPT + 10 others); Mon, 14 Oct 2019 03:08:25 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:35336 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730275AbfJNHIY (ORCPT ); Mon, 14 Oct 2019 03:08:24 -0400 Received: by mail-pf1-f195.google.com with SMTP id 205so9869507pfw.2 for ; Mon, 14 Oct 2019 00:08:22 -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:in-reply-to:references :in-reply-to:references; bh=c0QsMwW5/HlkG+EyBzY3CChBE/BthJe1X9zmk8IUDUw=; b=ro6DrO1FSFrjgnEbuCTFqXVAOUVvaYpkPhUpMZ3QcSfsKg7mJYalOmP12P9nqpUs1I ZzuRB2eVsqibk7k7fhjPHQwKoppJIb1DZz+fNE1uUnjV4+53EarSuH/nZTTMHXOHonEq IF/3wnllpGOFgEpK3auT7PifBwXLm3WxU3JdX13f0ZzF0I+8e/iaVMUK6Q/DBL2cZu3n 1g9EkexgpyNk8xDpuzMejRk99CzovZpYavY0EmELdxHBrs9m1SDjcHjfeEWkID4Ip4+Z QBtdkzX4/mq7v5Q7tCDLp3N0nXHtiKzUqfQavPSMs5E/ja8WQ3MUEKkamc6pEW/+e3Lw 05Kw== 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:in-reply-to:references; bh=c0QsMwW5/HlkG+EyBzY3CChBE/BthJe1X9zmk8IUDUw=; b=Ycy7B9nLWxsYBzMe76AufPPIWit44U67aSRjyQvJLTUVgLkKIhuygogMS9j0HRUcUi TehSmCo2UlMTMFC9E1STuEBHp4OgWjSIifYZ/MPejSxsy5xeJGx3blKyePVZv5erN37b T4SskcbwUKX+BdT99J98SS4CUoMvzy+WQ+k07SNsM+p0SJGz4LDhIEkaxYCUm/qYxqkP tlfXwncRVN1gnhuplmjeyKECVpsxqlusDClIcnXy2FWvIrIVNGtP52acJgxmBgCpW9Jp 9sDy2VQcOhgHXwcVsOmofanFpnSzFeaIK+f/JvZAux6IcHRsWGmYZfgRWVb8SasehoDd zZ7w== X-Gm-Message-State: APjAAAWq/B1oqWtHYuc3JWsfPtSi2Uju3o32KCWS9sKp8uS+oNH4DkU+ a/OL5qexvatdwNdc0FKowlSuyg== X-Received: by 2002:a65:44cb:: with SMTP id g11mr32096865pgs.145.1571036901879; Mon, 14 Oct 2019 00:08:21 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id p190sm20619948pfb.160.2019.10.14.00.08.18 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 14 Oct 2019 00:08:21 -0700 (PDT) From: Baolin Wang To: ohad@wizery.com, bjorn.andersson@linaro.org Cc: linus.walleij@linaro.org, orsonzhai@gmail.com, zhang.lyra@gmail.com, baolin.wang@linaro.org, linux-arm-kernel@lists.infradead.org, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/4] hwspinlock: Let the PM runtime can be optional Date: Mon, 14 Oct 2019 15:07:44 +0800 Message-Id: <6c03ca84b19f0e3a4bd60b4d5ea70fd801ed7555.1571036463.git.baolin.wang@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now some hwspinlock controllers did not have the requirement to implement the PM runtime, but drivers must enable the PM runtime to comply with the hwspinlock core. Thus we can change the PM runtime support to be optional by validating the -EACCES error number which means the PM runtime is not enabled, and removing the return value validating of pm_runtime_put(). So that we can remove some redundant PM runtime code in drivers. Signed-off-by: Baolin Wang --- drivers/hwspinlock/hwspinlock_core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- 1.7.9.5 diff --git a/drivers/hwspinlock/hwspinlock_core.c b/drivers/hwspinlock/hwspinlock_core.c index a22e252c..fd5f5c5 100644 --- a/drivers/hwspinlock/hwspinlock_core.c +++ b/drivers/hwspinlock/hwspinlock_core.c @@ -657,13 +657,15 @@ static int __hwspin_lock_request(struct hwspinlock *hwlock) /* notify PM core that power is now needed */ ret = pm_runtime_get_sync(dev); - if (ret < 0) { + if (ret < 0 && ret != -EACCES) { dev_err(dev, "%s: can't power on device\n", __func__); pm_runtime_put_noidle(dev); module_put(dev->driver->owner); return ret; } + ret = 0; + /* mark hwspinlock as used, should not fail */ tmp = radix_tree_tag_clear(&hwspinlock_tree, hwlock_to_id(hwlock), HWSPINLOCK_UNUSED); @@ -820,9 +822,7 @@ int hwspin_lock_free(struct hwspinlock *hwlock) } /* notify the underlying device that power is not needed */ - ret = pm_runtime_put(dev); - if (ret < 0) - goto out; + pm_runtime_put(dev); /* mark this hwspinlock as available */ tmp = radix_tree_tag_set(&hwspinlock_tree, hwlock_to_id(hwlock),