From patchwork Wed Nov 26 05:53:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 41524 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id DA6A925E72 for ; Wed, 26 Nov 2014 05:53:42 +0000 (UTC) Received: by mail-wi0-f199.google.com with SMTP id bs8sf1477117wib.10 for ; Tue, 25 Nov 2014 21:53:42 -0800 (PST) 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=qtmFzm736ZiNXA8XmqmusJzE85L485D+JB0/iIF17Lc=; b=UKciH5K/2iklUMVeq5YbdCro7V2gVvd4GxYJ/N9ZbX2R9aMUqmn5M/cjNRZ4xAPLeL EcpkDZHQn672jge/UgSw7Oo3Dv5maJOYIGyaBh/xuVKf7Ut/quBQ5flvRCXkjbPzMeFx TjbXxBwUsbcSSBFSyB9eBlcOXCJuqSdEn8X9yli5+LPDQckomYzmLVl5udZJ2/5aQgKf UiB3lkYnyAWullJctL534ReG4wPRaF2s2c2jV+MZDs/jMjWkjg+sr6t1TJTkomoZPDEy RY5+p/IExt9Js7OUUCJHeZoxH2JA9gC17nz8TghQBjZ3jKTThLIulEErfjpiI4fR6ZM5 6EGQ== X-Gm-Message-State: ALoCoQk5EGar9SwXae8/ViMk2DtfkCkUXTyiktqBYHwdBBb5t8uqeYKcDfaQg29Y8wznWc+8kIcY X-Received: by 10.194.109.131 with SMTP id hs3mr7932470wjb.0.1416981222196; Tue, 25 Nov 2014 21:53:42 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.87.139 with SMTP id ay11ls338849lab.51.gmail; Tue, 25 Nov 2014 21:53:41 -0800 (PST) X-Received: by 10.112.57.227 with SMTP id l3mr32023972lbq.68.1416981221745; Tue, 25 Nov 2014 21:53:41 -0800 (PST) Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com. [209.85.217.179]) by mx.google.com with ESMTPS id wt3si3327830lbb.44.2014.11.25.21.53.41 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 25 Nov 2014 21:53:41 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) client-ip=209.85.217.179; Received: by mail-lb0-f179.google.com with SMTP id z11so1826651lbi.38 for ; Tue, 25 Nov 2014 21:53:41 -0800 (PST) X-Received: by 10.152.8.170 with SMTP id s10mr32009683laa.56.1416981221531; Tue, 25 Nov 2014 21:53:41 -0800 (PST) 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.184.201 with SMTP id ew9csp572435lbc; Tue, 25 Nov 2014 21:53:40 -0800 (PST) X-Received: by 10.66.97.39 with SMTP id dx7mr50282015pab.65.1416981219874; Tue, 25 Nov 2014 21:53:39 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id fl2si5023000pad.233.2014.11.25.21.53.38 for ; Tue, 25 Nov 2014 21:53:39 -0800 (PST) Received-SPF: none (google.com: linux-pm-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752237AbaKZFxi (ORCPT + 12 others); Wed, 26 Nov 2014 00:53:38 -0500 Received: from mail-pd0-f182.google.com ([209.85.192.182]:39279 "EHLO mail-pd0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752216AbaKZFxh (ORCPT ); Wed, 26 Nov 2014 00:53:37 -0500 Received: by mail-pd0-f182.google.com with SMTP id r10so2086428pdi.41 for ; Tue, 25 Nov 2014 21:53:37 -0800 (PST) X-Received: by 10.68.102.195 with SMTP id fq3mr49201032pbb.7.1416981217189; Tue, 25 Nov 2014 21:53:37 -0800 (PST) Received: from localhost ([122.167.111.40]) by mx.google.com with ESMTPSA id ek5sm3147313pbd.4.2014.11.25.21.53.36 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 25 Nov 2014 21:53:36 -0800 (PST) From: Viresh Kumar To: Rafael Wysocki , edubezval@gmail.com Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, l.majewski@samsung.com, Viresh Kumar Subject: [PATCH 5/7] cpu_cooling: Don't match min/max frequencies for all CPUs on cooling register Date: Wed, 26 Nov 2014 11:23:00 +0530 Message-Id: <4bb7d02f8267ad9efd4dab070d72c2f2659bc752.1416980448.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.0.3.693.g996b0fd In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-pm@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.179 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: , In __cpufreq_cooling_register() we try to match min/max frequencies for all CPUs passed in 'clip_cpus' mask. This mask is the cpumask of cpus where the frequency constraints will be applied. Same frequency constraint can be applied only to the CPUs belonging to the same cluster (i.e. CPUs sharing clock line). For all such CPUs we have a single 'struct cpufreq_policy' structure managing them and so getting policies for all CPUs wouldn't make any sense as they will all return the same pointer. So, remove this useless check of checking min/max for all CPUs. Also update doc comment to make this more obvious that clip_cpus should be same as policy->related_cpus. Signed-off-by: Viresh Kumar --- Sorry if I don't understand cpu-cooling well, haven't done much work on it :( drivers/thermal/cpu_cooling.c | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index 1ab0018..1193cc4 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c @@ -420,6 +420,7 @@ static struct notifier_block thermal_cpufreq_notifier_block = { * __cpufreq_cooling_register - helper function to create cpufreq cooling device * @np: a valid struct device_node to the cooling device device tree node * @clip_cpus: cpumask of cpus where the frequency constraints will happen. + * Normally this should be same as cpufreq policy->related_cpus. * * This interface function registers the cpufreq cooling device with the name * "thermal-cpufreq-%x". This api can support multiple instances of cpufreq @@ -435,25 +436,9 @@ __cpufreq_cooling_register(struct device_node *np, { struct thermal_cooling_device *cool_dev; struct cpufreq_cooling_device *cpufreq_dev = NULL; - unsigned int min = 0, max = 0; char dev_name[THERMAL_NAME_LENGTH]; - int ret = 0, i; - struct cpufreq_policy policy; + int ret = 0; - /* Verify that all the clip cpus have same freq_min, freq_max limit */ - for_each_cpu(i, clip_cpus) { - /* continue if cpufreq policy not found and not return error */ - if (!cpufreq_get_policy(&policy, i)) - continue; - if (min == 0 && max == 0) { - min = policy.cpuinfo.min_freq; - max = policy.cpuinfo.max_freq; - } else { - if (min != policy.cpuinfo.min_freq || - max != policy.cpuinfo.max_freq) - return ERR_PTR(-EINVAL); - } - } cpufreq_dev = kzalloc(sizeof(struct cpufreq_cooling_device), GFP_KERNEL); if (!cpufreq_dev)