From patchwork Sat Aug 3 11:49:23 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 18750 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 C71F823981 for ; Sat, 3 Aug 2013 11:50:23 +0000 (UTC) Received: by mail-qa0-f71.google.com with SMTP id bq6sf471822qab.10 for ; Sat, 03 Aug 2013 04:50:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-beenthere:x-forwarded-to:x-forwarded-for :delivered-to:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:in-reply-to:references:x-gm-message-state :x-removed-original-auth:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=W535X/myGhaD9GoBtvK6BRJ5NoXsEJ1sWuT/GFbSAfw=; b=GNgqFgutJ7X/buGbFN8DfmYES+kxm4vguDjvgBbbYnTx8XHpfPCtoD0y/KFFcMmDh/ kZCf7fQ9jd+AIH1DbPuCFtPkWhRJwLu8WMw39qoGu5sbMS3ujB7WaZnHToPm01Et+36D Mq6kU71F4XDFJpvwLdSnoRG1iOIUncIgBcnGTXiE05yLBjKPNz4OBrmDrGf16s6oo4Bm paft7OfgZBwsQvInMyK+QkSXDrAYNOtptK6J8UWIrTH3RkGBedL25o6eCyw8U+Ljkqe6 A1DWuBEAAf9HuXbJRPKZ8EBveN0vdcFVjSgbBzxnPLDqUUXMpUng9JhAzgYLHVzql9Ha WE1A== X-Received: by 10.236.124.78 with SMTP id w54mr4608816yhh.44.1375530623589; Sat, 03 Aug 2013 04:50:23 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.105.225 with SMTP id gp1ls1007053qeb.55.gmail; Sat, 03 Aug 2013 04:50:23 -0700 (PDT) X-Received: by 10.220.249.7 with SMTP id mi7mr3399983vcb.72.1375530623474; Sat, 03 Aug 2013 04:50:23 -0700 (PDT) Received: from mail-ve0-f170.google.com (mail-ve0-f170.google.com [209.85.128.170]) by mx.google.com with ESMTPS id v7si2984541vcl.28.2013.08.03.04.50.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 03 Aug 2013 04:50:23 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.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.128.170; Received: by mail-ve0-f170.google.com with SMTP id 15so1701007vea.29 for ; Sat, 03 Aug 2013 04:50:23 -0700 (PDT) X-Received: by 10.58.154.34 with SMTP id vl2mr3476344veb.35.1375530623335; Sat, 03 Aug 2013 04:50:23 -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.221.11.8 with SMTP id pc8csp463vcb; Sat, 3 Aug 2013 04:50:22 -0700 (PDT) X-Received: by 10.68.137.134 with SMTP id qi6mr12487090pbb.154.1375530622346; Sat, 03 Aug 2013 04:50:22 -0700 (PDT) Received: from mail-pb0-f47.google.com (mail-pb0-f47.google.com [209.85.160.47]) by mx.google.com with ESMTPS id yk3si10549369pac.157.2013.08.03.04.50.22 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 03 Aug 2013 04:50:22 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.160.47 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.160.47; Received: by mail-pb0-f47.google.com with SMTP id rr4so1602345pbb.20 for ; Sat, 03 Aug 2013 04:50:22 -0700 (PDT) X-Received: by 10.68.253.227 with SMTP id ad3mr8590824pbd.63.1375530621953; Sat, 03 Aug 2013 04:50:21 -0700 (PDT) Received: from localhost ([122.172.193.46]) by mx.google.com with ESMTPSA id kd1sm16176695pab.20.2013.08.03.04.50.17 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 03 Aug 2013 04:50:21 -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, srivatsa.bhat@linux.vnet.ibm.com, l.majewski@samsung.com, Viresh Kumar Subject: [PATCH 05/10] cpufreq: Pass policy to cpufreq_add_policy_cpu() Date: Sat, 3 Aug 2013 17:19:23 +0530 Message-Id: <19511592474bddb0737664c79632b3c1341c9956.1375530162.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-Gm-Message-State: ALoCoQn7PmP/lVIqD67a9y0rIWAxrRVoO/2NPYbWWmdh/TpR3OnofqYJNkC/OTCsWxEggmZlOl6J 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.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 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: , Caller of cpufreq_add_policy_cpu() already has pointer to policy structure and so there is no need to find it again in cpufreq_add_policy_cpu(). Lets pass it directly. Reviewed-by: Srivatsa S. Bhat Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 47773a9..496e31c 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -889,21 +889,17 @@ static void cpufreq_init_policy(struct cpufreq_policy *policy) } #ifdef CONFIG_HOTPLUG_CPU -static int cpufreq_add_policy_cpu(unsigned int cpu, unsigned int sibling, - struct device *dev, bool frozen) +static int cpufreq_add_policy_cpu(struct cpufreq_policy *policy, + unsigned int cpu, struct device *dev, + bool frozen) { - struct cpufreq_policy *policy; int ret = 0, has_target = !!cpufreq_driver->target; unsigned long flags; - policy = cpufreq_cpu_get(sibling); - if (WARN_ON_ONCE(!policy)) - return -ENODATA; - if (has_target) __cpufreq_governor(policy, CPUFREQ_GOV_STOP); - lock_policy_rwsem_write(sibling); + lock_policy_rwsem_write(policy->cpu); write_lock_irqsave(&cpufreq_driver_lock, flags); @@ -912,7 +908,7 @@ static int cpufreq_add_policy_cpu(unsigned int cpu, unsigned int sibling, per_cpu(cpufreq_cpu_data, cpu) = policy; write_unlock_irqrestore(&cpufreq_driver_lock, flags); - unlock_policy_rwsem_write(sibling); + unlock_policy_rwsem_write(policy->cpu); if (has_target) { __cpufreq_governor(policy, CPUFREQ_GOV_START); @@ -923,7 +919,6 @@ static int cpufreq_add_policy_cpu(unsigned int cpu, unsigned int sibling, if (!frozen) ret = sysfs_create_link(&dev->kobj, &policy->kobj, "cpufreq"); - cpufreq_cpu_put(policy); return ret; } #endif @@ -1006,8 +1001,7 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif, struct cpufreq_policy *cp = per_cpu(cpufreq_cpu_data, sibling); if (cp && cpumask_test_cpu(cpu, cp->related_cpus)) { read_unlock_irqrestore(&cpufreq_driver_lock, flags); - return cpufreq_add_policy_cpu(cpu, sibling, dev, - frozen); + return cpufreq_add_policy_cpu(cp, cpu, dev, frozen); } } read_unlock_irqrestore(&cpufreq_driver_lock, flags);