From patchwork Tue Feb 25 08:50:10 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 25243 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f70.google.com (mail-oa0-f70.google.com [209.85.219.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9E9E320558 for ; Tue, 25 Feb 2014 08:50:56 +0000 (UTC) Received: by mail-oa0-f70.google.com with SMTP id n16sf189049oag.9 for ; Tue, 25 Feb 2014 00:50:56 -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=RDuKcOmTqz1Jx93/L1sLLK8bCUghwvOKhidkl2McYjI=; b=Uoi4JwtbDzSzJfW3xzkCLUAMASX/VBTZPldiJXvmXW0ruNTuv9yPQO7bTdUTByJppZ bUb8DS2P354CfJtHEe057GAEiRMMOcPU8b2mjZ9oCQ3JWKiApYpuIBTb20K2jWU1/TdB ZWq4pdMDh0N37z5bSBgfD815gX+00Pjq8MXFkOFsnZMhbxw9osPNWidJeUQ4hCeFADep cLwAVKp1slkyOjAb/PfRgmKcYjSsa2E14Xhg/wr7aY/yL12jQfRQEwIAJelf5YJPkaD6 fabX36G5tkDfpeoxuA6jQUIp7hnHU4RKnvzJ26JYyRi1JZTI50aoB6b0fC8GR8/qC8A4 Fj7g== X-Gm-Message-State: ALoCoQkObhKt9JMTjdigAFDJqHqzGFon2lMYWd/yyE4mpzU1o4BYYPMcUnsYRtqzNmla20cd6Sw0 X-Received: by 10.50.222.103 with SMTP id ql7mr11580693igc.1.1393318256131; Tue, 25 Feb 2014 00:50:56 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.51.130 with SMTP id u2ls2384520qga.34.gmail; Tue, 25 Feb 2014 00:50:56 -0800 (PST) X-Received: by 10.52.104.68 with SMTP id gc4mr127721vdb.2.1393318253570; Tue, 25 Feb 2014 00:50:53 -0800 (PST) Received: from mail-vc0-f170.google.com (mail-vc0-f170.google.com [209.85.220.170]) by mx.google.com with ESMTPS id uo16si6651126veb.48.2014.02.25.00.50.53 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 25 Feb 2014 00:50:53 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.170 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.170; Received: by mail-vc0-f170.google.com with SMTP id hu8so6969942vcb.15 for ; Tue, 25 Feb 2014 00:50:53 -0800 (PST) X-Received: by 10.221.66.132 with SMTP id xq4mr77113vcb.57.1393318253469; Tue, 25 Feb 2014 00:50:53 -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.220.174.196 with SMTP id u4csp122301vcz; Tue, 25 Feb 2014 00:50:52 -0800 (PST) X-Received: by 10.66.129.133 with SMTP id nw5mr390862pab.98.1393318251327; Tue, 25 Feb 2014 00:50:51 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id wp1si19942276pab.165.2014.02.25.00.50.50; Tue, 25 Feb 2014 00:50:50 -0800 (PST) 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 S1752181AbaBYIu2 (ORCPT + 26 others); Tue, 25 Feb 2014 03:50:28 -0500 Received: from mail-we0-f177.google.com ([74.125.82.177]:57637 "EHLO mail-we0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751853AbaBYIuZ (ORCPT ); Tue, 25 Feb 2014 03:50:25 -0500 Received: by mail-we0-f177.google.com with SMTP id t61so69361wes.8 for ; Tue, 25 Feb 2014 00:50:24 -0800 (PST) X-Received: by 10.180.73.141 with SMTP id l13mr1434594wiv.60.1393318224297; Tue, 25 Feb 2014 00:50:24 -0800 (PST) Received: from localhost ([213.122.173.131]) by mx.google.com with ESMTPSA id k10sm48871370wjf.11.2014.02.25.00.50.21 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 25 Feb 2014 00:50:23 -0800 (PST) From: Viresh Kumar To: rjw@rjwysocki.net, skannan@codeaurora.org Cc: linaro-kernel@lists.linaro.org, cpufreq@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, srivatsa.bhat@linux.vnet.ibm.com, Viresh Kumar Subject: [PATCH 2/3] cpufreq: Initialize policy before making it available for others to use Date: Tue, 25 Feb 2014 14:20:10 +0530 Message-Id: <57b8ab66ba21f42c91311641319cec16d2c8923d.1393318100.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e In-Reply-To: <9f9546137135103556c69815c72b81ed93cc1ca2.1393318100.git.viresh.kumar@linaro.org> References: <9f9546137135103556c69815c72b81ed93cc1ca2.1393318100.git.viresh.kumar@linaro.org> In-Reply-To: <9f9546137135103556c69815c72b81ed93cc1ca2.1393318100.git.viresh.kumar@linaro.org> References: <9f9546137135103556c69815c72b81ed93cc1ca2.1393318100.git.viresh.kumar@linaro.org> 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=neutral (google.com: 209.85.220.170 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 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 must be fully initialized before it is being made available for use by others. This patch moves some initialization code before making policy available for others. Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index cc4f244..110c0cd 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1116,6 +1116,20 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif, goto err_set_policy_cpu; } + /* related cpus should atleast have policy->cpus */ + cpumask_or(policy->related_cpus, policy->related_cpus, policy->cpus); + + /* + * affected cpus must always be the one, which are online. We aren't + * managing offline cpus here. + */ + cpumask_and(policy->cpus, policy->cpus, cpu_online_mask); + + if (!frozen) { + policy->user_policy.min = policy->min; + policy->user_policy.max = policy->max; + } + write_lock_irqsave(&cpufreq_driver_lock, flags); for_each_cpu(j, policy->cpus) per_cpu(cpufreq_cpu_data, j) = policy; @@ -1169,20 +1183,6 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif, } } - /* related cpus should atleast have policy->cpus */ - cpumask_or(policy->related_cpus, policy->related_cpus, policy->cpus); - - /* - * affected cpus must always be the one, which are online. We aren't - * managing offline cpus here. - */ - cpumask_and(policy->cpus, policy->cpus, cpu_online_mask); - - if (!frozen) { - policy->user_policy.min = policy->min; - policy->user_policy.max = policy->max; - } - blocking_notifier_call_chain(&cpufreq_policy_notifier_list, CPUFREQ_START, policy);