From patchwork Mon May 18 05:13:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 48678 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5B00021411 for ; Mon, 18 May 2015 05:15:39 +0000 (UTC) Received: by lagv1 with SMTP id v1sf6707898lag.1 for ; Sun, 17 May 2015 22:15:38 -0700 (PDT) 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=ZyMOBfUEVR1JKp+dk4H3e2eubKdIatq9HwWJ8HOehks=; b=HGlhXoqu15KPc9/DmSrw77uA1O5o05ar2/NWz865f7NxN/BZ3waOV3emMATWRS15xL s+EyVvNv17XZKRA1ife9+N1H1lk/+9kT6MTa+MoUWrnfBvpsPM711gC+0tzUodMS6JCv BH8lZiy10ASR0xvNr9E5ROQC0WG314JdO5wYGQpnGmELUWR0WufYHZcYaxtiKIdikpCS cmEj+9V+D8z38RTyDH0rzuf9xfLF0lJIuuzBbjdTvP2CA+rWmo0waRrWNfRplEd07vTB 6AbtAAWjgju6viwOklVkxgoP9gpZZIDKA2fT6HUS53rNVCGa1oh7DbZ99KCclIfkKNoZ PBNQ== X-Gm-Message-State: ALoCoQnkAboK+Yh70WAoUeYo/4eHA0hz20YVi0W5Irk6KhM/i8PxMpGbeMye/lTHJ0Q6JJKX5n3X X-Received: by 10.180.97.9 with SMTP id dw9mr8620618wib.2.1431926138316; Sun, 17 May 2015 22:15:38 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.207.2 with SMTP id ls2ls732111lac.31.gmail; Sun, 17 May 2015 22:15:38 -0700 (PDT) X-Received: by 10.152.5.98 with SMTP id r2mr4308505lar.101.1431926138159; Sun, 17 May 2015 22:15:38 -0700 (PDT) Received: from mail-la0-f45.google.com (mail-la0-f45.google.com. [209.85.215.45]) by mx.google.com with ESMTPS id zz9si5941629lbb.157.2015.05.17.22.15.38 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 17 May 2015 22:15:38 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) client-ip=209.85.215.45; Received: by laat2 with SMTP id t2so201831780laa.1 for ; Sun, 17 May 2015 22:15:38 -0700 (PDT) X-Received: by 10.112.140.231 with SMTP id rj7mr15798787lbb.76.1431926138051; Sun, 17 May 2015 22:15:38 -0700 (PDT) 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.108.230 with SMTP id hn6csp3711984lbb; Sun, 17 May 2015 22:15:37 -0700 (PDT) X-Received: by 10.66.191.226 with SMTP id hb2mr41171922pac.72.1431926136318; Sun, 17 May 2015 22:15:36 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id iu9si2678127pbc.77.2015.05.17.22.15.20; Sun, 17 May 2015 22:15:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-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 S1751285AbbERFOd (ORCPT + 11 others); Mon, 18 May 2015 01:14:33 -0400 Received: from mail-pa0-f43.google.com ([209.85.220.43]:32979 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751183AbbERFOc (ORCPT ); Mon, 18 May 2015 01:14:32 -0400 Received: by padbw4 with SMTP id bw4so136059384pad.0 for ; Sun, 17 May 2015 22:14:32 -0700 (PDT) X-Received: by 10.70.133.66 with SMTP id pa2mr41512132pdb.164.1431926072604; Sun, 17 May 2015 22:14:32 -0700 (PDT) Received: from localhost ([122.167.226.34]) by mx.google.com with ESMTPSA id ht10sm8611580pdb.41.2015.05.17.22.14.31 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 17 May 2015 22:14:31 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, sboyd@codeaurora.org, prarit@redhat.com, skannan@codeaurora.org, Srivatsa Bhat , Viresh Kumar Subject: [PATCH V5 11/14] cpufreq: Remove cpufreq_update_policy() Date: Mon, 18 May 2015 10:43:34 +0530 Message-Id: X-Mailer: git-send-email 2.4.0 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.215.45 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: , cpufreq_update_policy() was kept as a separate routine earlier as it was handling migration of sysfs directories, which isn't done anymore. It is only updating policy->cpu now and can be removed. Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq.c | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index b07a3387f2bc..a16dd26b39f1 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1108,6 +1108,10 @@ static struct cpufreq_policy *cpufreq_policy_restore(unsigned int cpu) if (likely(policy)) { /* Policy should be inactive here */ WARN_ON(!policy_is_inactive(policy)); + + down_write(&policy->rwsem); + policy->cpu = cpu; + up_write(&policy->rwsem); } return policy; @@ -1192,16 +1196,6 @@ static void cpufreq_policy_free(struct cpufreq_policy *policy) kfree(policy); } -static void update_policy_cpu(struct cpufreq_policy *policy, unsigned int cpu) -{ - if (WARN_ON(cpu == policy->cpu)) - return; - - down_write(&policy->rwsem); - policy->cpu = cpu; - up_write(&policy->rwsem); -} - /** * cpufreq_add_dev - add a CPU device * @@ -1260,15 +1254,6 @@ static int cpufreq_add_dev(struct device *dev, struct subsys_interface *sif) goto nomem_out; } - /* - * In the resume path, since we restore a saved policy, the assignment - * to policy->cpu is like an update of the existing policy, rather than - * the creation of a brand new one. So we need to perform this update - * by invoking update_policy_cpu(). - */ - if (recover_policy && cpu != policy->cpu) - update_policy_cpu(policy, cpu); - cpumask_copy(policy->cpus, cpumask_of(cpu)); /* call driver. From then on the cpufreq must be able @@ -1449,11 +1434,14 @@ static int __cpufreq_remove_dev_prepare(struct device *dev, if (cpu != policy->cpu) return 0; - if (cpus > 1) + if (cpus > 1) { /* Nominate new CPU */ - update_policy_cpu(policy, cpumask_any_but(policy->cpus, cpu)); - else if (cpufreq_driver->stop_cpu) + down_write(&policy->rwsem); + policy->cpu = cpumask_any_but(policy->cpus, cpu); + up_write(&policy->rwsem); + } else if (cpufreq_driver->stop_cpu) { cpufreq_driver->stop_cpu(policy); + } return 0; }