From patchwork Wed Aug 9 04:51:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 109691 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp373288qge; Tue, 8 Aug 2017 21:51:57 -0700 (PDT) X-Received: by 10.98.98.129 with SMTP id w123mr3748304pfb.221.1502254316906; Tue, 08 Aug 2017 21:51:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502254316; cv=none; d=google.com; s=arc-20160816; b=KhYXKwI2bhkJzHBovzUy4jmq5PpBeyk/NqJa2dMKLSY0ISPOdGMOk/4H7wb0lPhvno JpVGd+/iVJyLy82c6mT7jzuN3A/fWmx13Oa9WX15EYisuMhjGXSz+jj6ULA3OUCR3P7x ldUmD60Pfkc36DtLAjsIfYnuxINd5+PxiYKTHhShZIp3AM2+ITHqWJei7eX4gCGiGE5D gKeqaLnlVxRMUntMes4d9CPeK6+mngxwIB0Edmg8wZRleVaQBIhzQddXBmkctLO500c1 WbPBgRvigX+xPypKneWnd9Pq42NLsB1WYPW0HT6aY3NGMyHL+LCXkUnNyYRpKrGG+ev+ RhMA== 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=my/QijTQkd5x69/vKcJH5JTGdqcvCtm+IZG1JHJDZTg=; b=sSYd93z0QIWAFezt4ny/9oOWHrST4CZ1+WxLIfGKJXmOMqEDxKcBIPPuMtkuGX6hQ2 AxwBvFGjhA98yzgkXd0FVs0WKz5Lb1PlaadZ9fPpuyfCvLaGVUS5HdJeJAiUHN+RLTIc pyR95TcrI13Jg5QzG53g6r+1Bmrm+U5jN59JXHHzMOZtKcg+Hy4nn4Lk+KJ5b+WfolkK gbdBnUOHf28KWXHFec2+KGPkkBfcQXLPuArejGoH1bZS1eYReJyr4qbgjmc9XzsnQU3w tP/J9KGyYeoiC9eHzBvzcQ0PxTbZnUGba/qHTlSL6cY6z9jJWNDPZrUjhoUUMyslD9s8 npGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NFZmwW10; 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 f61si2056907plb.703.2017.08.08.21.51.56; Tue, 08 Aug 2017 21:51:56 -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=NFZmwW10; 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 S1750866AbdHIEvy (ORCPT + 12 others); Wed, 9 Aug 2017 00:51:54 -0400 Received: from mail-pf0-f174.google.com ([209.85.192.174]:36594 "EHLO mail-pf0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750797AbdHIEvx (ORCPT ); Wed, 9 Aug 2017 00:51:53 -0400 Received: by mail-pf0-f174.google.com with SMTP id c28so23111455pfe.3 for ; Tue, 08 Aug 2017 21:51:53 -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=my/QijTQkd5x69/vKcJH5JTGdqcvCtm+IZG1JHJDZTg=; b=NFZmwW10yM8c+Wlpy8+7Rml97HyKPA+l1WWGHsVl8x/Mh9RPPrYDUm6UtgTDXczLP6 MUKHVLu5WDsbxbYa+NfVVlQTbx8lBfSEDuDV6+DnVUEke39abh+VQbRi+rMC2mJi2UOw VOmYGbA58yWl+TXS6/Wj5ylH1rML8dt86ftLk= 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=my/QijTQkd5x69/vKcJH5JTGdqcvCtm+IZG1JHJDZTg=; b=ETxzY31wLh3YigffhI1b1vSM4OQCEpEie8binzF1G92qF4Jt/fvcv38SRzxJtNlSgc XtLwRk7ZI/h/m2/t2/njQEH1et+jBjNe0sbb9Z664+NijVPHbklPjgyf35cScOnUqII/ 9X9477J1zHGwMONLE38zhembalMK/im9wAj3fMygbplGuaP21jKzSzn1x5iAdrr50hkK JcI5g4ZruH4x3JKvCJWRLr3fj2nbZLF+PBMHRgiRkv7RVsiwIoC7P/MF8bjxbQMOstw4 /FcDl1rnv5fyoNyVe1NkAcROG1cJiV5kuvrvInxLM+7M5QYTtLPscpBaKN++XHSAfJaT Eg7g== X-Gm-Message-State: AHYfb5hHQhoQ9vHDVfSLPav2YBU9g2immOXQDuTLV8rl7UtDnhW4FGe6 AXdE4Ojur5NBDgGI X-Received: by 10.99.112.86 with SMTP id a22mr6593724pgn.151.1502254313256; Tue, 08 Aug 2017 21:51:53 -0700 (PDT) Received: from localhost ([122.171.226.174]) by smtp.gmail.com with ESMTPSA id a87sm5321994pfg.18.2017.08.08.21.51.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Aug 2017 21:51:51 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Ingo Molnar , Peter Zijlstra Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , sudeep.holla@arm.com, Dietmar.Eggemann@arm.com, linux-kernel@vger.kernel.org Subject: [PATCH] cpufreq: Return 0 from ->fast_switch() on errors Date: Wed, 9 Aug 2017 10:21:46 +0530 Message-Id: X-Mailer: git-send-email 2.13.0.71.gd7076ec9c9cb Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org CPUFREQ_ENTRY_INVALID is a special symbol which is used to specify that an entry in the cpufreq table is invalid. But using it outside of the scope of the cpufreq table looks a bit incorrect. We can represent an invalid frequency by writing it as 0 instead if we need. Note that it is already done that way for the return value of the ->get() callback. Lets do the same for ->fast_switch() and not use CPUFREQ_ENTRY_INVALID outside of the scope of cpufreq table. Also update the comment over cpufreq_driver_fast_switch() to clearly mention what this returns. None of the drivers return CPUFREQ_ENTRY_INVALID as of now from ->fast_switch() callback and so we don't need to update any of those. Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq.c | 7 ++++--- kernel/sched/cpufreq_schedutil.c | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) -- 2.13.0.71.gd7076ec9c9cb diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index b2cc98551fc3..9588e15da26b 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1832,9 +1832,10 @@ EXPORT_SYMBOL(cpufreq_unregister_notifier); * twice in parallel for the same policy and that it will never be called in * parallel with either ->target() or ->target_index() for the same policy. * - * If CPUFREQ_ENTRY_INVALID is returned by the driver's ->fast_switch() - * callback to indicate an error condition, the hardware configuration must be - * preserved. + * Returns the actual frequency set for the CPU. + * + * If 0 is returned by the driver's ->fast_switch() callback to indicate an + * error condition, the hardware configuration must be preserved. */ unsigned int cpufreq_driver_fast_switch(struct cpufreq_policy *policy, unsigned int target_freq) diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index 5465bf221e8f..2e74c49776be 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -123,7 +123,7 @@ static void sugov_update_commit(struct sugov_policy *sg_policy, u64 time, if (policy->fast_switch_enabled) { next_freq = cpufreq_driver_fast_switch(policy, next_freq); - if (next_freq == CPUFREQ_ENTRY_INVALID) + if (!next_freq) return; policy->cur = next_freq;