From patchwork Mon Jul 1 11:26:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 168204 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2802051ilk; Mon, 1 Jul 2019 04:26:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqxYm0dkKn0CVcIDZ6XtIVWeZu2RKfPpIdxe5Tpaa/iahQiVmEXAW5+HsAQn2OGR+4TM8/Hr X-Received: by 2002:a17:90a:cb81:: with SMTP id a1mr29785023pju.81.1561980392233; Mon, 01 Jul 2019 04:26:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561980392; cv=none; d=google.com; s=arc-20160816; b=VA9E22VowaV7K0sIF+Kw+Y330XG3bNvUXf47DtuvaLI2G71Z0jhTIi2Q2Bb2avgdea SEDs1uYPra3asvy30aiCiZjghhV9rvwp1nXvbKx7hF3vfOoPbOkv4rEZZ5x6IiyipbSz W7dUSEZVQpJZmNIBM5nj2gIKjSgEeo5oLMn3qhFkxA37qWfsVJfY4RSrEl6wWqg17dHC wOesubVHx/T0Qz6nTH+6Mkmb5N5gUs+IqOt7cyzNQh3ZbGPyiviiYPqlgPvohesfqZsk zYr1x/C8G1QypGoevFIuCqI1IAQp8HYPJlmteSd9yJ9STXfvA3+XJMCX/mliaEE3svrY baEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=PlxocW5hWVYXfPkN8RZ8vxi1sxzrmOenQcvIcTZd5kM=; b=QuhmlXK9XYb6yU285X/VBruZ3f/C8k80PrYeA7v2xhsApf0i1d7LoDvunH+h98rzqK KhDsAJDuyG4daxSeH8DxBbdinMiC/UxQvu412ZuVSVWK7oSI/YUwoBr/0c+tFT2yeSb2 DkydPEfPg9FYZge2LpngIa7qF/Czt0zDd3imGDbRFCchrzLkNbgNarUOjXhE9yj5xVa9 iM6pfUn+Df0I4eYuMThqhvmdKk6AeZ4gYPBzednZa+JawUXQZIiA5nmarAjvMJDDiL3o U/trVg2/krBUOqL2O2WRibk+cM74BNVfF/LAYGohbem1liu0LsM6aR3NxWL01cEi4WCg BPGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XUamftty; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 d7si10868394pfr.145.2019.07.01.04.26.31; Mon, 01 Jul 2019 04:26:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-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=XUamftty; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 S1728473AbfGAL0a (ORCPT + 11 others); Mon, 1 Jul 2019 07:26:30 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:45632 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728441AbfGAL0a (ORCPT ); Mon, 1 Jul 2019 07:26:30 -0400 Received: by mail-pg1-f195.google.com with SMTP id o13so1414200pgp.12 for ; Mon, 01 Jul 2019 04:26:30 -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 :mime-version:content-transfer-encoding; bh=PlxocW5hWVYXfPkN8RZ8vxi1sxzrmOenQcvIcTZd5kM=; b=XUamfttyP80qdspJgf1uIrYuYqNj/n0X1CzPBvPz4mMVT/y51sj6kZS6OMaVHEigV0 AWHBSQtCgD6fzdYqfjQ4vQ5+CSxugvayzemLhR5nad63DIF2NZptTU7b3vY/IAsf4Kqh qaL7GgFhQfaCU/UQ6zPKAYk0JZpem/ygA+1PtSJumre9Jf0FyXphj6sUSAmM7jrpd8zo ra/51juPWGNEtGpCyxWs4AggISzIwaTywOYJHN26VS+B4tS8k5b1ooEwWHnscsmtlpDN zu3qVHaTP20si2JQVegs0PzPnBAsBoSoV1Jc12R516XJNpRs2qPPMmGz5lgMahUGQTas 8Q5g== 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=PlxocW5hWVYXfPkN8RZ8vxi1sxzrmOenQcvIcTZd5kM=; b=DXO7sGpTNOdbO84qKWKbBOC+NNpBNT/DagqZnxeW0Duv9mxUbL1fnRySK7oLcqV37m 4PHT04qaR+qML6kphwX6rDWg6QdILN7MiqG0b0o/5MiZ1Q/LHDRbBWUMsnN7423fyIa7 HUyESOeTdqD3X7CPYMK/kvdk0vQdYCwb/Wh+AHIU+7n4qi0kBgTli4NuW534btfROC86 sYObZ8B1wDo++3lWQm2l4Vv/95OMR2XHTAxST744NlhYvvPkG+3wRySMTf9N8Q1yw185 6u9t6g7c/orTNk4JBKlyxYSzjzzPMrItQS5tBoGAXhoxIZjnZM8A6uj2NlJZ6DJzv++v WLnQ== X-Gm-Message-State: APjAAAWJtc2mI1WoMjRdDIJUkxyJGwbSlgsS2OkfrSoV/E7+mm0C3Onh r3Mpu4s5dFOeBT2kuIsT9gsm5w== X-Received: by 2002:a65:62c2:: with SMTP id m2mr24639022pgv.413.1561980389387; Mon, 01 Jul 2019 04:26:29 -0700 (PDT) Received: from localhost ([122.172.21.205]) by smtp.gmail.com with ESMTPSA id m4sm19139569pff.108.2019.07.01.04.26.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Jul 2019 04:26:28 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Kevin Hilman , Ulf Hansson , Len Brown , Pavel Machek , Daniel Lezcano Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Qais.Yousef@arm.com, mka@chromium.org, juri.lelli@gmail.com, linux-kernel@vger.kernel.org Subject: [PATCH V5 2/7] PM / QOS: Rename __dev_pm_qos_read_value() and dev_pm_qos_raw_read_value() Date: Mon, 1 Jul 2019 16:56:10 +0530 Message-Id: <5c38b4a94f5114bbc99f62d89d4c09f877194dc7.1561979715.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.21.0.rc0.269.g1a574e7a288b In-Reply-To: References: MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org dev_pm_qos_read_value() will soon need to support more constraint types (min/max frequency) and will have another argument to it, i.e. type of the constraint. While that is fine for the existing users of dev_pm_qos_read_value(), but not that optimal for the callers of __dev_pm_qos_read_value() and dev_pm_qos_raw_read_value() as all the callers of these two routines are only looking for resume latency constraint. Lets make these two routines care only about the resume latency constraint and rename them to __dev_pm_qos_resume_latency() and dev_pm_qos_raw_resume_latency(). Suggested-by: Rafael J. Wysocki Signed-off-by: Viresh Kumar --- drivers/base/power/domain_governor.c | 2 +- drivers/base/power/qos.c | 13 +++++++++---- drivers/base/power/runtime.c | 2 +- drivers/cpuidle/governor.c | 2 +- include/linux/pm_qos.h | 8 ++++---- 5 files changed, 16 insertions(+), 11 deletions(-) -- 2.21.0.rc0.269.g1a574e7a288b diff --git a/drivers/base/power/domain_governor.c b/drivers/base/power/domain_governor.c index 3838045c9277..20e56a5be01f 100644 --- a/drivers/base/power/domain_governor.c +++ b/drivers/base/power/domain_governor.c @@ -66,7 +66,7 @@ static bool default_suspend_ok(struct device *dev) td->constraint_changed = false; td->cached_suspend_ok = false; td->effective_constraint_ns = 0; - constraint_ns = __dev_pm_qos_read_value(dev); + constraint_ns = __dev_pm_qos_resume_latency(dev); spin_unlock_irqrestore(&dev->power.lock, flags); diff --git a/drivers/base/power/qos.c b/drivers/base/power/qos.c index cfd463212513..7a0d197f0809 100644 --- a/drivers/base/power/qos.c +++ b/drivers/base/power/qos.c @@ -90,16 +90,16 @@ enum pm_qos_flags_status dev_pm_qos_flags(struct device *dev, s32 mask) EXPORT_SYMBOL_GPL(dev_pm_qos_flags); /** - * __dev_pm_qos_read_value - Get PM QoS constraint for a given device. + * __dev_pm_qos_resume_latency - Get resume latency constraint for a given device. * @dev: Device to get the PM QoS constraint value for. * * This routine must be called with dev->power.lock held. */ -s32 __dev_pm_qos_read_value(struct device *dev) +s32 __dev_pm_qos_resume_latency(struct device *dev) { lockdep_assert_held(&dev->power.lock); - return dev_pm_qos_raw_read_value(dev); + return dev_pm_qos_raw_resume_latency(dev); } /** @@ -112,7 +112,12 @@ s32 dev_pm_qos_read_value(struct device *dev) s32 ret; spin_lock_irqsave(&dev->power.lock, flags); - ret = __dev_pm_qos_read_value(dev); + + if (IS_ERR_OR_NULL(dev->power.qos)) + ret = PM_QOS_RESUME_LATENCY_NO_CONSTRAINT; + else + ret = pm_qos_read_value(&dev->power.qos->resume_latency); + spin_unlock_irqrestore(&dev->power.lock, flags); return ret; diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c index 952a1e7057c7..b75335508d2c 100644 --- a/drivers/base/power/runtime.c +++ b/drivers/base/power/runtime.c @@ -275,7 +275,7 @@ static int rpm_check_suspend_allowed(struct device *dev) || (dev->power.request_pending && dev->power.request == RPM_REQ_RESUME)) retval = -EAGAIN; - else if (__dev_pm_qos_read_value(dev) == 0) + else if (__dev_pm_qos_resume_latency(dev) == 0) retval = -EPERM; else if (dev->power.runtime_status == RPM_SUSPENDED) retval = 1; diff --git a/drivers/cpuidle/governor.c b/drivers/cpuidle/governor.c index 9fddf828a76f..2e3e14192bee 100644 --- a/drivers/cpuidle/governor.c +++ b/drivers/cpuidle/governor.c @@ -110,7 +110,7 @@ int cpuidle_governor_latency_req(unsigned int cpu) { int global_req = pm_qos_request(PM_QOS_CPU_DMA_LATENCY); struct device *device = get_cpu_device(cpu); - int device_req = dev_pm_qos_raw_read_value(device); + int device_req = dev_pm_qos_raw_resume_latency(device); return device_req < global_req ? device_req : global_req; } diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h index 1f4d456e8fff..06aa88496761 100644 --- a/include/linux/pm_qos.h +++ b/include/linux/pm_qos.h @@ -139,7 +139,7 @@ s32 pm_qos_read_value(struct pm_qos_constraints *c); #ifdef CONFIG_PM enum pm_qos_flags_status __dev_pm_qos_flags(struct device *dev, s32 mask); enum pm_qos_flags_status dev_pm_qos_flags(struct device *dev, s32 mask); -s32 __dev_pm_qos_read_value(struct device *dev); +s32 __dev_pm_qos_resume_latency(struct device *dev); s32 dev_pm_qos_read_value(struct device *dev); int dev_pm_qos_add_request(struct device *dev, struct dev_pm_qos_request *req, enum dev_pm_qos_req_type type, s32 value); @@ -176,7 +176,7 @@ static inline s32 dev_pm_qos_requested_flags(struct device *dev) return dev->power.qos->flags_req->data.flr.flags; } -static inline s32 dev_pm_qos_raw_read_value(struct device *dev) +static inline s32 dev_pm_qos_raw_resume_latency(struct device *dev) { return IS_ERR_OR_NULL(dev->power.qos) ? PM_QOS_RESUME_LATENCY_NO_CONSTRAINT : @@ -189,7 +189,7 @@ static inline enum pm_qos_flags_status __dev_pm_qos_flags(struct device *dev, static inline enum pm_qos_flags_status dev_pm_qos_flags(struct device *dev, s32 mask) { return PM_QOS_FLAGS_UNDEFINED; } -static inline s32 __dev_pm_qos_read_value(struct device *dev) +static inline s32 __dev_pm_qos_resume_latency(struct device *dev) { return PM_QOS_RESUME_LATENCY_NO_CONSTRAINT; } static inline s32 dev_pm_qos_read_value(struct device *dev) { return PM_QOS_RESUME_LATENCY_NO_CONSTRAINT; } @@ -245,7 +245,7 @@ static inline s32 dev_pm_qos_requested_resume_latency(struct device *dev) return PM_QOS_RESUME_LATENCY_NO_CONSTRAINT; } static inline s32 dev_pm_qos_requested_flags(struct device *dev) { return 0; } -static inline s32 dev_pm_qos_raw_read_value(struct device *dev) +static inline s32 dev_pm_qos_raw_resume_latency(struct device *dev) { return PM_QOS_RESUME_LATENCY_NO_CONSTRAINT; }