From patchwork Fri Nov 28 09:44:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 41679 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f69.google.com (mail-wg0-f69.google.com [74.125.82.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 26E64244C2 for ; Fri, 28 Nov 2014 09:45:28 +0000 (UTC) Received: by mail-wg0-f69.google.com with SMTP id k14sf3882007wgh.0 for ; Fri, 28 Nov 2014 01:45:27 -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=3JtOcupx2qXYtnMp3+fTfTKG1cZ16DLulF2usutx2Ok=; b=EXezgq3EnsuakUGboHixyiIVKG8v1nnDyB9jEtm6lOzD1MQB1IPHY7SlKmF7R10nA+ xMv7RtlpOWe5XenAx+6kFWFA4VZ9Dg1y4lE5I2lOemzo2LIqJbTPvSb8ZBPLJG3kLc/j Fn+uVOXBiCoHMmWbyoWut97UQar8P3gsZi8VkvoWCWNyw7kth+sRnybdnWozSOSQ6R5r GEHYSTRsLu6FuHPtpEu+pZWBRgJAUWURByptiZ5SGQTfpp6QnCQZrj4Dc3Ezh1d2fkBa T6rti+CU/Llp+hXkHOQfxz0gp0qKMsSGQbLBvsggKrSujmi6q0KrEQw9LR3y2oF4e/1l nxag== X-Gm-Message-State: ALoCoQnOXi2Suo77JpImh9Vl6Wkvz2h+Pwk5obLIdtpzDNTQcYruqIWdmgcQwBIXxZshKcSMiiBe X-Received: by 10.112.169.101 with SMTP id ad5mr4210941lbc.1.1417167927416; Fri, 28 Nov 2014 01:45:27 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.242.161 with SMTP id wr1ls458917lac.48.gmail; Fri, 28 Nov 2014 01:45:27 -0800 (PST) X-Received: by 10.112.130.65 with SMTP id oc1mr43447409lbb.7.1417167927143; Fri, 28 Nov 2014 01:45:27 -0800 (PST) Received: from mail-lb0-f180.google.com (mail-lb0-f180.google.com. [209.85.217.180]) by mx.google.com with ESMTPS id ej5si9489907lad.34.2014.11.28.01.45.26 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 28 Nov 2014 01:45:26 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.180 as permitted sender) client-ip=209.85.217.180; Received: by mail-lb0-f180.google.com with SMTP id l4so5177962lbv.25 for ; Fri, 28 Nov 2014 01:45:26 -0800 (PST) X-Received: by 10.152.87.100 with SMTP id w4mr42220725laz.27.1417167926790; Fri, 28 Nov 2014 01:45:26 -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 ew9csp60439lbc; Fri, 28 Nov 2014 01:45:25 -0800 (PST) X-Received: by 10.70.136.202 with SMTP id qc10mr70964712pdb.152.1417167925096; Fri, 28 Nov 2014 01:45:25 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id vj10si15336419pbc.138.2014.11.28.01.45.24 for ; Fri, 28 Nov 2014 01:45:25 -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 S1751752AbaK1JpX (ORCPT + 12 others); Fri, 28 Nov 2014 04:45:23 -0500 Received: from mail-pd0-f176.google.com ([209.85.192.176]:48963 "EHLO mail-pd0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751743AbaK1JpW (ORCPT ); Fri, 28 Nov 2014 04:45:22 -0500 Received: by mail-pd0-f176.google.com with SMTP id y10so6389661pdj.7 for ; Fri, 28 Nov 2014 01:45:22 -0800 (PST) X-Received: by 10.66.140.76 with SMTP id re12mr69493308pab.147.1417167922149; Fri, 28 Nov 2014 01:45:22 -0800 (PST) Received: from localhost ([122.167.111.40]) by mx.google.com with ESMTPSA id i3sm9405516pdi.41.2014.11.28.01.45.20 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 28 Nov 2014 01:45:21 -0800 (PST) From: Viresh Kumar To: linux-pm@vger.kernel.org, edubezval@gmail.com Cc: linaro-kernel@lists.linaro.org, rui.zhang@intel.com, Viresh Kumar Subject: [PATCH 12/26] cpu_cooling: Don't match min/max frequencies for all CPUs on cooling register Date: Fri, 28 Nov 2014 15:14:06 +0530 Message-Id: <0ca43eb27849888b58a263bf589490b678bfffef.1417167599.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.180 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 --- 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 964586f..c358ede 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c @@ -434,6 +434,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 @@ -449,25 +450,9 @@ __cpufreq_cooling_register(struct device_node *np, { struct thermal_cooling_device *cool_dev; struct cpufreq_cooling_device *cpufreq_dev; - 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(*cool_dev), GFP_KERNEL); if (!cpufreq_dev) return ERR_PTR(-ENOMEM);