From patchwork Tue Jan 27 08:36:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 43830 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f70.google.com (mail-wg0-f70.google.com [74.125.82.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5C5B92409D for ; Tue, 27 Jan 2015 08:37:47 +0000 (UTC) Received: by mail-wg0-f70.google.com with SMTP id b13sf6818585wgh.1 for ; Tue, 27 Jan 2015 00:37:46 -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=KS5M2UyPXjJBtNlpgdFuFEKY5ENuP5xfxkMw65PkFH4=; b=i6o3PkXXgoLl5f+zTGJ7oeI4QwUeerap6Z5yTwa2Jed2fgskVKhXSKY08mE1Vm/7aB Upsy0w2zbDkm4z7xBf59hdhCNzmr9XKfleDByS8QSgrTil8rqi2EaJNEcbCP3pOzx/AE 37GvSP73grLJ9ayynED3Kd1hPLNxYZKsP45y6eRPolNraUx0HDSuyyCOPu0Bova9zjTm CqAQZhtUotZo3y/90V322c0Gv/+t5fcWx8KORysL6I9htoD8Csq/Efv6w3FWEmLgHFOe gJcAT7Y1bHe2TZCh14xAMUjzckelyNYr7sQZs5oWiVGUVV4BHKXIC7X0p+MERvnpImuB +7mQ== X-Gm-Message-State: ALoCoQn4yQ3/wmLjdmfitQCaQrfxv8dhoSF46tSY2Y4NgQPVKpFZPG4sPcTZrcEn8WR5PM3oOwd8 X-Received: by 10.112.30.131 with SMTP id s3mr27448lbh.13.1422347866633; Tue, 27 Jan 2015 00:37:46 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.6.130 with SMTP id b2ls4891laa.27.gmail; Tue, 27 Jan 2015 00:37:46 -0800 (PST) X-Received: by 10.152.20.169 with SMTP id o9mr177745lae.50.1422347866329; Tue, 27 Jan 2015 00:37:46 -0800 (PST) Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com. [209.85.217.169]) by mx.google.com with ESMTPS id rb6si592488lbb.8.2015.01.27.00.37.45 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 27 Jan 2015 00:37:45 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) client-ip=209.85.217.169; Received: by mail-lb0-f169.google.com with SMTP id f15so11884600lbj.0 for ; Tue, 27 Jan 2015 00:37:45 -0800 (PST) X-Received: by 10.152.20.169 with SMTP id o9mr177712lae.50.1422347865913; Tue, 27 Jan 2015 00:37:45 -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.112.35.133 with SMTP id h5csp1025616lbj; Tue, 27 Jan 2015 00:37:44 -0800 (PST) X-Received: by 10.68.209.133 with SMTP id mm5mr260303pbc.54.1422347857579; Tue, 27 Jan 2015 00:37:37 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g8si627522pdk.182.2015.01.27.00.37.36; Tue, 27 Jan 2015 00:37:37 -0800 (PST) Received-SPF: none (google.com: linux-pm-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754074AbbA0Ihf (ORCPT + 11 others); Tue, 27 Jan 2015 03:37:35 -0500 Received: from mail-pd0-f169.google.com ([209.85.192.169]:59863 "EHLO mail-pd0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757924AbbA0Ihe (ORCPT ); Tue, 27 Jan 2015 03:37:34 -0500 Received: by mail-pd0-f169.google.com with SMTP id g10so17615629pdj.0 for ; Tue, 27 Jan 2015 00:37:33 -0800 (PST) X-Received: by 10.70.90.226 with SMTP id bz2mr41041197pdb.157.1422347853607; Tue, 27 Jan 2015 00:37:33 -0800 (PST) Received: from localhost ([122.178.198.250]) by mx.google.com with ESMTPSA id i4sm849538pdl.11.2015.01.27.00.37.32 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 27 Jan 2015 00:37:33 -0800 (PST) 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, Viresh Kumar Subject: [PATCH 14/18] cpufreq: Remove cpufreq_update_policy() Date: Tue, 27 Jan 2015 14:06:20 +0530 Message-Id: X-Mailer: git-send-email 2.3.0.rc0.44.ga94655d 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.217.169 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 | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 8b110a50c22e..fde0a75f9692 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1058,6 +1058,12 @@ static struct cpufreq_policy *cpufreq_policy_restore(unsigned int cpu) } read_unlock_irqrestore(&cpufreq_driver_lock, flags); + if (policy) { + down_write(&policy->rwsem); + policy->cpu = cpu; + up_write(&policy->rwsem); + } + return policy; } @@ -1130,16 +1136,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); -} - static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif) { unsigned int cpu = dev->id; @@ -1185,15 +1181,6 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif) write_unlock_irqrestore(&cpufreq_driver_lock, flags); } - /* - * 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 @@ -1401,11 +1388,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; }