From patchwork Tue Aug 20 06:38:26 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 19344 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f71.google.com (mail-qa0-f71.google.com [209.85.216.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E038625E5D for ; Tue, 20 Aug 2013 06:41:03 +0000 (UTC) Received: by mail-qa0-f71.google.com with SMTP id bq6sf315306qab.6 for ; Mon, 19 Aug 2013 23:41:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-gm-message-state:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:in-reply-to:references :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=IqAmDA+dRMesSHqZ7w0Yc6XMUxve3FnuRDKeX+FMcGM=; b=W2y9Csl99NWr8pSL7Udy6UnLYivh98MIRH9z4rE8j3+89td2WBqnaWkVnoFdMpQBSm oC1cjPEoXENPW4y7+KeBYbSZTWJmxkTTJvfBE9fypXO3/TvCj4fxArL07Qq7lav/81Ww wcLxDCZxVvo7E+htEp5NK4zr7dh13qKBVKuaMoWQVRvZTv9xjLT3k5SEUg/ZA+Ci5+tc 7npzBO23F6cTHlXBw8vOslHvmE4fCiYg+xn6DE5JSd4n9fJTst0BSITcYfOYV9hOu13m Hncq/EpQ8w25q8kkGykSWUd0nWSQja2+mebcuHIVTa5j3Da6ZE26MT2YSKd7eW83dVYv et2g== X-Received: by 10.236.209.103 with SMTP id r67mr5891886yho.35.1376980863707; Mon, 19 Aug 2013 23:41:03 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.49.196 with SMTP id w4ls97531qen.71.gmail; Mon, 19 Aug 2013 23:41:03 -0700 (PDT) X-Received: by 10.220.145.132 with SMTP id d4mr24228vcv.9.1376980863588; Mon, 19 Aug 2013 23:41:03 -0700 (PDT) Received: from mail-ve0-f179.google.com (mail-ve0-f179.google.com [209.85.128.179]) by mx.google.com with ESMTPS id ix2si21841vdb.20.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 19 Aug 2013 23:41:03 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.179 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.179; Received: by mail-ve0-f179.google.com with SMTP id c13so12478vea.38 for ; Mon, 19 Aug 2013 23:41:03 -0700 (PDT) X-Gm-Message-State: ALoCoQkA9qhnuIoZ0+SYuz3TSnBhuTDZKiwMffO8Z9eH3LJfG1suC7u34FBz935vLcgFH2YMCcwH X-Received: by 10.52.75.131 with SMTP id c3mr25749vdw.68.1376980863500; Mon, 19 Aug 2013 23:41:03 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp138898vcz; Mon, 19 Aug 2013 23:41:03 -0700 (PDT) X-Received: by 10.66.161.229 with SMTP id xv5mr1881736pab.87.1376980862627; Mon, 19 Aug 2013 23:41:02 -0700 (PDT) Received: from mail-pd0-f175.google.com (mail-pd0-f175.google.com [209.85.192.175]) by mx.google.com with ESMTPS id hk5si1363807pac.125.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 19 Aug 2013 23:41:02 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.192.175 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.192.175; Received: by mail-pd0-f175.google.com with SMTP id q10so26684pdj.20 for ; Mon, 19 Aug 2013 23:41:02 -0700 (PDT) X-Received: by 10.68.201.6 with SMTP id jw6mr189320pbc.202.1376980862210; Mon, 19 Aug 2013 23:41:02 -0700 (PDT) Received: from localhost ([106.200.1.10]) by mx.google.com with ESMTPSA id yo2sm1767053pab.8.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 19 Aug 2013 23:41:01 -0700 (PDT) From: Viresh Kumar To: rjw@sisk.pl Cc: linaro-kernel@lists.linaro.org, patches@linaro.org, cpufreq@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Viresh Kumar Subject: [PATCH 5/5] cpufreq: Use cpufreq_policy_list for iterating over policies Date: Tue, 20 Aug 2013 12:08:26 +0530 Message-Id: <41cb4f97aed084ff3f851c820f23283a02a02d42.1376979090.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e In-Reply-To: References: In-Reply-To: References: X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.179 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , To iterate over all policies we currently iterate over all CPUs and then get the policy for each of them. Let's use the newly created cpufreq_policy_list for this purpose. Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 0586bd2..81ceea6 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -961,8 +961,8 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif, struct cpufreq_policy *policy; unsigned long flags; #ifdef CONFIG_HOTPLUG_CPU + struct cpufreq_policy *tpolicy; struct cpufreq_governor *gov; - int sibling; #endif if (cpu_is_offline(cpu)) @@ -985,11 +985,10 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif, #ifdef CONFIG_HOTPLUG_CPU /* Check if this cpu was hot-unplugged earlier and has siblings */ read_lock_irqsave(&cpufreq_driver_lock, flags); - for_each_online_cpu(sibling) { - struct cpufreq_policy *cp = per_cpu(cpufreq_cpu_data, sibling); - if (cp && cpumask_test_cpu(cpu, cp->related_cpus)) { + list_for_each_entry(tpolicy, &cpufreq_policy_list, policy_list) { + if (cpumask_test_cpu(cpu, tpolicy->related_cpus)) { read_unlock_irqrestore(&cpufreq_driver_lock, flags); - ret = cpufreq_add_policy_cpu(cp, cpu, dev, frozen); + ret = cpufreq_add_policy_cpu(tpolicy, cpu, dev, frozen); up_read(&cpufreq_rwsem); return ret; }