From patchwork Tue Aug 6 17:23:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 18808 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qe0-f70.google.com (mail-qe0-f70.google.com [209.85.128.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E3FAC25DF6 for ; Tue, 6 Aug 2013 17:24:13 +0000 (UTC) Received: by mail-qe0-f70.google.com with SMTP id 6sf749904qeb.1 for ; Tue, 06 Aug 2013 10:24:13 -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=CFLtgBco9t3td3nY0cnl58lqphhSI5JEJxFtfwqIaiw=; b=C6vSaWZ9YpqnSzxFVAkahYe45vVjY5ILC4CEJXBTQhVYyohth6ZTLO2GsGfFq6gVTj d6K0nZutjnOqRi2MzXtPO7gaVw5YvNs2Cf3UESugdjEKD3ruDWdppfYbbfk70kCm1bEU jE7Y0NKR8/PT/zZLWgYuTLuR1Y3TfeC8nyy4wB7kiy+2No5e0aw1ytn/j5/hA7qweHOq I84BS+WI+rCX9tFVhtPZlQOgZAy5ck++qBmSlGft2YHwnAOg4JepGMda01tg1EyEn4tj V8dvxOkZt1s1RkAuCarVTRWkXxKPALM/RFQvlwkVjh5RBQKnXqP2UEZXfmDFxKtDpnrm YMsw== X-Received: by 10.236.113.197 with SMTP id a45mr855579yhh.14.1375809853726; Tue, 06 Aug 2013 10:24:13 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.51.40 with SMTP id h8ls297255qeo.28.gmail; Tue, 06 Aug 2013 10:24:13 -0700 (PDT) X-Received: by 10.58.199.133 with SMTP id jk5mr701156vec.63.1375809853568; Tue, 06 Aug 2013 10:24:13 -0700 (PDT) Received: from mail-ve0-f182.google.com (mail-ve0-f182.google.com [209.85.128.182]) by mx.google.com with ESMTPS id gq10si532032vdc.95.2013.08.06.10.24.13 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 06 Aug 2013 10:24:13 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.182 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.182; Received: by mail-ve0-f182.google.com with SMTP id m1so721188ves.13 for ; Tue, 06 Aug 2013 10:24:13 -0700 (PDT) X-Gm-Message-State: ALoCoQnc765gpOO1+7j/RXXFvMwgChUsOGZkQRwMSSdjVstkIT9UuBhuXP2pQGyLDh4i8wrmBKXq X-Received: by 10.52.164.16 with SMTP id ym16mr591665vdb.32.1375809853431; Tue, 06 Aug 2013 10:24:13 -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 pc8csp157126vcb; Tue, 6 Aug 2013 10:24:12 -0700 (PDT) X-Received: by 10.66.255.10 with SMTP id am10mr4397239pad.165.1375809852510; Tue, 06 Aug 2013 10:24:12 -0700 (PDT) Received: from mail-pa0-f49.google.com (mail-pa0-f49.google.com [209.85.220.49]) by mx.google.com with ESMTPS id bv1si1947283pbb.174.2013.08.06.10.24.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 06 Aug 2013 10:24:12 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.49 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.220.49; Received: by mail-pa0-f49.google.com with SMTP id bi5so1017531pad.8 for ; Tue, 06 Aug 2013 10:24:12 -0700 (PDT) X-Received: by 10.68.252.137 with SMTP id zs9mr2736531pbc.60.1375809852121; Tue, 06 Aug 2013 10:24:12 -0700 (PDT) Received: from localhost ([122.172.193.46]) by mx.google.com with ESMTPSA id lm2sm5266205pab.2.2013.08.06.10.24.08 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 06 Aug 2013 10:24:11 -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, Viresh Kumar Subject: [PATCH V2 05/11] cpufreq: Pass policy to cpufreq_add_policy_cpu() Date: Tue, 6 Aug 2013 22:53:07 +0530 Message-Id: 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.182 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. 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 7864a90..9e83d91 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -890,21 +890,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); @@ -913,7 +909,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); @@ -924,7 +920,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 @@ -1007,8 +1002,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);