From patchwork Mon Oct 17 18:16:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 77794 Delivered-To: patches@linaro.org Received: by 10.140.97.247 with SMTP id m110csp517968qge; Mon, 17 Oct 2016 11:17:12 -0700 (PDT) X-Received: by 10.25.133.198 with SMTP id h189mr14109123lfd.95.1476728232870; Mon, 17 Oct 2016 11:17:12 -0700 (PDT) Return-Path: Received: from mail-lf0-x22d.google.com (mail-lf0-x22d.google.com. [2a00:1450:4010:c07::22d]) by mx.google.com with ESMTPS id 7si19681788lfe.353.2016.10.17.11.17.12 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Oct 2016 11:17:12 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::22d as permitted sender) client-ip=2a00:1450:4010:c07::22d; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::22d as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by mail-lf0-x22d.google.com with SMTP id l131so253149756lfl.2 for ; Mon, 17 Oct 2016 11:17:12 -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; bh=/kPSuqyHIl6fwsDrUD+mT0yUlnxsWUpMtl9glqCJwfs=; b=UjD31mQ5zx/B7foqAOv/DWbXHHRVSQ4IaKsirXs7m1SLy2YC4i7uz1f0RA2k6LZnTm UZABIb1U6wa3lwkD7OGQZE4mBVKyYsUSrjuOhJ3LPZ3kW1j//ASUJ++fuzibXs2RxsRH bpvGoZpTkCbtnqmiLBjcw7OvFAcFTpeDQ7AXk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/kPSuqyHIl6fwsDrUD+mT0yUlnxsWUpMtl9glqCJwfs=; b=R/dveCLUs3oEqJ5QKmLp/mpyttIiuMqOGEURA76OzpxVyeGyMQ1k3GXo4dueuhOvzH c/1AaypwNlyo2Eyke6UppHzCUebQOTMPUfJa5cvvDL9ERGLH2ufwFQGiBK/aUenV7Bk/ +Uq5WlSYgZrVnb61Ct8gW0JQ4BnwJt3S8GzXThlRsbXVkhR7WTg2ijf5TA99sOkMbsze 7BKm5Pf9Xgy3SmAQXlfaqqvLXeNPRl4mf3xxYQPOwV3iN+5y9KWWNVlLmFOpn4Vub0Qs H2x30b76eKKFRarge3/yAPmDIFAlplGHudbwQhWoYR1CSK7/BA5N/3aaNwzIT4QxhnBl uYsA== X-Gm-Message-State: AA6/9RkmhcVLe03xZjOKS79opBgvK61W9wpc2AdMV8YNEb9xckrayHRDxjjmafg7/GH5R9V7o1g= X-Received: by 10.25.159.76 with SMTP id i73mr16479067lfe.136.1476728232109; Mon, 17 Oct 2016 11:17:12 -0700 (PDT) Return-Path: Received: from localhost.localdomain (h-155-4-221-67.na.cust.bahnhof.se. [155.4.221.67]) by smtp.gmail.com with ESMTPSA id r20sm8230251lfr.19.2016.10.17.11.17.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 17 Oct 2016 11:17:11 -0700 (PDT) From: Ulf Hansson To: "Rafael J. Wysocki" , Alan Stern , Ulf Hansson , linux-pm@vger.kernel.org Cc: Len Brown , Pavel Machek , Kevin Hilman , Geert Uytterhoeven , Lina Iyer , Jon Hunter , Marek Szyprowski , Linus Walleij Subject: [PATCH 1/4] PM / Runtime: Remove the exported function pm_children_suspended() Date: Mon, 17 Oct 2016 20:16:58 +0200 Message-Id: <1476728221-26530-2-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1476728221-26530-1-git-send-email-ulf.hansson@linaro.org> References: <1476728221-26530-1-git-send-email-ulf.hansson@linaro.org> The exported function pm_children_suspended() has only one caller, which is the runtime PM internal function, rpm_check_suspend_allowed(). Let's clean-up this code, by removing pm_children_suspended() altogether and instead do the one-liner check directly in rpm_check_suspend_allowed(). Signed-off-by: Ulf Hansson --- drivers/base/power/runtime.c | 3 ++- include/linux/pm_runtime.h | 7 ------- 2 files changed, 2 insertions(+), 8 deletions(-) -- 1.9.1 Reviewed-by: Linus Walleij diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c index f662267..5e4e5ec 100644 --- a/drivers/base/power/runtime.c +++ b/drivers/base/power/runtime.c @@ -241,7 +241,8 @@ static int rpm_check_suspend_allowed(struct device *dev) retval = -EACCES; else if (atomic_read(&dev->power.usage_count) > 0) retval = -EAGAIN; - else if (!pm_children_suspended(dev)) + else if (!dev->power.ignore_children && + atomic_read(&dev->power.child_count)) retval = -EBUSY; /* Pending resume requests take precedence over suspends. */ diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h index 2e14d26..61ea566 100644 --- a/include/linux/pm_runtime.h +++ b/include/linux/pm_runtime.h @@ -61,12 +61,6 @@ static inline void pm_suspend_ignore_children(struct device *dev, bool enable) dev->power.ignore_children = enable; } -static inline bool pm_children_suspended(struct device *dev) -{ - return dev->power.ignore_children - || !atomic_read(&dev->power.child_count); -} - static inline void pm_runtime_get_noresume(struct device *dev) { atomic_inc(&dev->power.usage_count); @@ -162,7 +156,6 @@ static inline void pm_runtime_allow(struct device *dev) {} static inline void pm_runtime_forbid(struct device *dev) {} static inline void pm_suspend_ignore_children(struct device *dev, bool enable) {} -static inline bool pm_children_suspended(struct device *dev) { return false; } static inline void pm_runtime_get_noresume(struct device *dev) {} static inline void pm_runtime_put_noidle(struct device *dev) {} static inline bool device_run_wake(struct device *dev) { return false; }