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: 51681 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by patches.linaro.org (Postfix) with ESMTPS id 9839E22DB5 for ; Thu, 30 Jul 2015 07:11:48 +0000 (UTC) Received: by lafd3 with SMTP id d3sf10936261laf.1 for ; Thu, 30 Jul 2015 00:11:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:in-reply-to:references :sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=Qo/1meZNhRfHBBaRCIypUy7/o4HoRkNVdzOMS/IRE+c=; b=gavMI1iGfeGjlsqrXX8xY/5cIjXQXfdsy4iuA52RW9jWTIEOfzoLsQ6uGNHp0kAZ8F fJ83HBAsyZeIrXzOtAjxOQ7PhYvNx94SNhQXPiQFHPXGxXuvMMJd9L3YPM/wtjYlQN7e 1joYu6IVuwvySKu/B1ORrz1uiJ/2Xs0Q00urp8lv6pF4d+NavFutSKWNPVWBS1jnHjfq /b4yvkLGnLpiLuQlUfF/TpIWq0wgey+Gti1VTuYypBiZwCidjbgTIvtoVZzGZMaBPjNM n+oLW3N1y1Vjszm9r1hBhSO3xsbqxQiTQvc/AFjITezCeeVTXAZpcxDtiRKfRwakdPgw NsGg== X-Gm-Message-State: ALoCoQlb2+5GEs/YuiPZODcxV3jUZV+fst9Tln0svzpRVS8qBa0xX3cKvCs1Knew+Ik9IxjlKHVC X-Received: by 10.112.42.236 with SMTP id r12mr17237066lbl.2.1438240307525; Thu, 30 Jul 2015 00:11:47 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.204.135 with SMTP id ky7ls153434lac.20.gmail; Thu, 30 Jul 2015 00:11:46 -0700 (PDT) X-Received: by 10.112.138.100 with SMTP id qp4mr41437931lbb.85.1438240306969; Thu, 30 Jul 2015 00:11:46 -0700 (PDT) Received: from mail-lb0-f176.google.com (mail-lb0-f176.google.com. [209.85.217.176]) by mx.google.com with ESMTPS id a2si81517lah.138.2015.07.30.00.11.46 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Jul 2015 00:11:46 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) client-ip=209.85.217.176; Received: by lbbyj8 with SMTP id yj8so21276668lbb.0 for ; Thu, 30 Jul 2015 00:11:46 -0700 (PDT) X-Received: by 10.112.120.134 with SMTP id lc6mr42999774lbb.86.1438240306892; Thu, 30 Jul 2015 00:11:46 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.7.198 with SMTP id l6csp362009lba; Thu, 30 Jul 2015 00:11:45 -0700 (PDT) X-Received: by 10.66.65.234 with SMTP id a10mr23146216pat.2.1438240304949; Thu, 30 Jul 2015 00:11:44 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x14si319413pas.117.2015.07.30.00.11.43; Thu, 30 Jul 2015 00:11:44 -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; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754625AbbG3HLm (ORCPT + 25 others); Thu, 30 Jul 2015 03:11:42 -0400 Received: from mail-pa0-f51.google.com ([209.85.220.51]:35433 "EHLO mail-pa0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754511AbbG3HLU (ORCPT ); Thu, 30 Jul 2015 03:11:20 -0400 Received: by pabkd10 with SMTP id kd10so18796867pab.2 for ; Thu, 30 Jul 2015 00:11:20 -0700 (PDT) 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-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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; }