From patchwork Thu Dec 4 04:11:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 41897 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id DB30D25E88 for ; Thu, 4 Dec 2014 04:13:40 +0000 (UTC) Received: by mail-la0-f72.google.com with SMTP id gq15sf10390289lab.7 for ; Wed, 03 Dec 2014 20:13:39 -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=oZMgmWORZJ7XVkZQr/Il7vyy+Cj86gnfJ6kvAUIyR84=; b=FmRUprm0B0YLzB/vRvIXwoCJ7yTG1txJr/EQxDqnEt/yJ4fmE5/5Y11UTl243mrfBs NgZTZ4qX6FlwHrSfeLup3ihPuVSjzr+I0ltQePzf2DMDvdZYKncPfH6lxWy6dFNdsY6b 5PD69BFtZivCpHW4p1ra+x/c1e7DEEiQF+ZHYHHvggadV6WovPZsTMhzLxWlLs8H+CBv m0QM358ucdaZ4UURvF7v/O36tb6OfCt47YPBiKR+6FdEQVUCgzfPwcjdKPoFIktERpYt dXPMthobm7vcFyw7LA4qI9y/mPV6XyIcvFHAu/qkqKZI6rE3Yhz0KC2Fa7l83caY0qZl lk8w== X-Gm-Message-State: ALoCoQkUlauSXbTy7cHGgOUVXFtSmUf1mAkPp8/aaSRWa4kRZJhK2CB/yNxChb+SsP33PLovSuLL X-Received: by 10.112.42.104 with SMTP id n8mr6293lbl.19.1417666419844; Wed, 03 Dec 2014 20:13:39 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.5.227 with SMTP id v3ls240436lav.91.gmail; Wed, 03 Dec 2014 20:13:39 -0800 (PST) X-Received: by 10.152.37.38 with SMTP id v6mr7486366laj.10.1417666419568; Wed, 03 Dec 2014 20:13:39 -0800 (PST) Received: from mail-lb0-f171.google.com (mail-lb0-f171.google.com. [209.85.217.171]) by mx.google.com with ESMTPS id t10si24619756lat.82.2014.12.03.20.13.39 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Dec 2014 20:13:39 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.171 as permitted sender) client-ip=209.85.217.171; Received: by mail-lb0-f171.google.com with SMTP id n15so13342669lbi.2 for ; Wed, 03 Dec 2014 20:13:39 -0800 (PST) X-Received: by 10.112.235.196 with SMTP id uo4mr7163965lbc.66.1417666419474; Wed, 03 Dec 2014 20:13:39 -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 ew9csp781065lbc; Wed, 3 Dec 2014 20:13:38 -0800 (PST) X-Received: by 10.68.57.167 with SMTP id j7mr22197684pbq.160.1417666417824; Wed, 03 Dec 2014 20:13:37 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id df1si18139882pdb.237.2014.12.03.20.13.37 for ; Wed, 03 Dec 2014 20:13:37 -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 S1752996AbaLDENg (ORCPT + 12 others); Wed, 3 Dec 2014 23:13:36 -0500 Received: from mail-pa0-f49.google.com ([209.85.220.49]:50855 "EHLO mail-pa0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752992AbaLDENg (ORCPT ); Wed, 3 Dec 2014 23:13:36 -0500 Received: by mail-pa0-f49.google.com with SMTP id eu11so17074460pac.22 for ; Wed, 03 Dec 2014 20:13:35 -0800 (PST) X-Received: by 10.68.57.199 with SMTP id k7mr22074640pbq.88.1417666415715; Wed, 03 Dec 2014 20:13:35 -0800 (PST) Received: from localhost ([122.166.92.172]) by mx.google.com with ESMTPSA id ye3sm24357219pbb.93.2014.12.03.20.13.34 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 03 Dec 2014 20:13:35 -0800 (PST) From: Viresh Kumar To: linux-pm@vger.kernel.org, edubezval@gmail.com Cc: linaro-kernel@lists.linaro.org, rui.zhang@intel.com, amit.daniel@samsung.com, javi.merino@arm.com, Viresh Kumar Subject: [PATCH V2 13/26] thermal: cpu_cooling: Don't match min/max frequencies for all CPUs on cooling register Date: Thu, 4 Dec 2014 09:41:55 +0530 Message-Id: <6eae693e7f14744315bdff8b4bd7fb11de7b08ce.1417664938.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.171 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 5c9a2ef..f325738 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c @@ -437,6 +437,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 @@ -452,30 +453,14 @@ __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, i; - struct cpufreq_policy policy; + int ret; if (!cpufreq_frequency_get_table(cpumask_first(clip_cpus))) { pr_debug("%s: CPUFreq table not found\n", __func__); return ERR_PTR(-EPROBE_DEFER); } - /* 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(*cpufreq_dev), GFP_KERNEL); if (!cpufreq_dev) return ERR_PTR(-ENOMEM);