From patchwork Thu Jul 30 07:10:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 6899031 X-Patchwork-Delegate: rui.zhang@intel.com Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 2B3E5C05AC for ; Thu, 30 Jul 2015 07:12:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DE7232056D for ; Thu, 30 Jul 2015 07:11:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F04722056E for ; Thu, 30 Jul 2015 07:11:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751326AbbG3HLl (ORCPT ); Thu, 30 Jul 2015 03:11:41 -0400 Received: from mail-pa0-f54.google.com ([209.85.220.54]:32865 "EHLO mail-pa0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754517AbbG3HLU (ORCPT ); Thu, 30 Jul 2015 03:11:20 -0400 Received: by padck2 with SMTP id ck2so18889032pad.0 for ; Thu, 30 Jul 2015 00:11:20 -0700 (PDT) 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:in-reply-to:references; bh=hXh8QOp2hKd+cE4evUAbzH9YQBLXf3cmFsVIUoHjTxE=; b=GEm9p3lu/tbEVdjnsvyjLiQBqAj9CddNxe1DK0D4fr6WNIyjsG44ngfGpCUL9DrYKt FOzyb9wKeI1XPz5A4qPHqmIEPwwam4biBTATVbjPzzr6SiBzJH8RUhtLGLZUzykXQEVD tdNTOLOOBMf8xVaaUP+SNTMlDOAv90FfBrBt7ViKeYQpgE5guyETsUUbQp+HzuSgd1z3 Vng1o29EtGoFdCCqxaEexzU++Wi/9/719tEMG5s3BxQp1L2IheWA4zz99zF1seSzAfom iwvefFi8MCmYf/MWEgwnQnZi46k5arDo3v42XybIAEFUlJICun4scIK+N1fez1N7fPgj 1Owg== X-Gm-Message-State: ALoCoQnNfpbpCNVognTUpa9x4Giwxf1rkyUSR54txdakA6lEHZHARQYAQ+XYakgV7wEI2rkwZjky X-Received: by 10.66.101.104 with SMTP id ff8mr103425046pab.59.1438240280000; Thu, 30 Jul 2015 00:11:20 -0700 (PDT) Received: from localhost ([122.171.186.190]) by smtp.gmail.com with ESMTPSA id v3sm363886pdp.8.2015.07.30.00.11.18 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 30 Jul 2015 00:11:19 -0700 (PDT) From: Viresh Kumar To: edubezval@gmail.com Cc: linaro-kernel@lists.linaro.org, rui.zhang@intel.com, linux-pm@vger.kernel.org, radivoje.jovanovic@linux.intel.com, punit.agrawal@arm.com, Viresh Kumar , linux-kernel@vger.kernel.org (open list) Subject: [PATCH 6/6] thermal/cpu_cooling: update policy limits if clipped_freq < policy->max Date: Thu, 30 Jul 2015 12:40:35 +0530 Message-Id: <5a3411e7341a4208d0d67c0c5ea2208a4c5ee658.1438239727.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.4.0 In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP policy->max is the maximum allowed frequency defined by user and clipped_freq is the maximum that thermal constraints allow. If clipped_freq is lower than policy->max, then we need to readjust policy->max. But, if clipped_freq is greater than policy->max, we don't need to do anything. We used to call cpufreq_verify_within_limits() in this case, but it doesn't change anything in this case. Lets skip this unnecessary call and write a comment that explains this. Signed-off-by: Viresh Kumar --- drivers/thermal/cpu_cooling.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index 9209c324a7fc..d9a603588cb5 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c @@ -226,9 +226,20 @@ static int cpufreq_thermal_notifier(struct notifier_block *nb, if (!cpumask_test_cpu(policy->cpu, &cpufreq_dev->allowed_cpus)) continue; + /* + * policy->max is the maximum allowed frequency defined by user + * and clipped_freq is the maximum that thermal constraints + * allow. + * + * If clipped_freq is lower than policy->max, then we need to + * readjust policy->max. + * + * But, if clipped_freq is greater than policy->max, we don't + * need to do anything. + */ clipped_freq = cpufreq_dev->clipped_freq; - if (policy->max != clipped_freq) + if (policy->max > clipped_freq) cpufreq_verify_within_limits(policy, 0, clipped_freq); break; }