From patchwork Fri May 8 06:23:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 48154 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 696FF2121F for ; Fri, 8 May 2015 06:25:17 +0000 (UTC) Received: by wixv7 with SMTP id v7sf4291275wix.0 for ; Thu, 07 May 2015 23:25:16 -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=nJkqRBaAx3RTqysyKW05b3BlNAw09zhbpxpqvClhQDw=; b=i2XmREzobKqi6ZWOGKLv7Nvw2YI29wfXR3IZS3533dKJY71dNK5bzdWKlyznXCbtYO wC/UZPno2M1Tx1d0pBtX0FxlU7jgXi8HKIdy+ld4HTaTfApFhhhNisfHydsxt359Jo9V xYWsVnErM4VkrfhYI9ml8Tftx6Tv5MOduL+qLGEWxMzCwtKBF6ov+aPVH5vOL83eZW60 dgMST8TlH/hkH4/KO0PMOaqNPn0Wf28kNRO3nlU/z9bSyy3ayBjFpvAQdo49RpynHP2d q1achGp6swx2VNclyUcKikR6e/58zL3oPdMK/8OtUhbCMZoUENeZpJc5GtjKqYF+kuyL JKvg== X-Gm-Message-State: ALoCoQl+oiLjgKrkT5Enb1EDrqbTDaympgvH8/fe3ABts3pbvvPOQmkX5zGnO2QWrmnr3wljOm48 X-Received: by 10.194.5.229 with SMTP id v5mr1258097wjv.0.1431066316780; Thu, 07 May 2015 23:25:16 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.27.229 with SMTP id w5ls286763lag.44.gmail; Thu, 07 May 2015 23:25:16 -0700 (PDT) X-Received: by 10.112.205.69 with SMTP id le5mr1679571lbc.65.1431066316611; Thu, 07 May 2015 23:25:16 -0700 (PDT) Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com. [209.85.217.169]) by mx.google.com with ESMTPS id le13si2689690lbb.27.2015.05.07.23.25.16 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 May 2015 23:25:16 -0700 (PDT) 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 lbbzk7 with SMTP id zk7so46528472lbb.0 for ; Thu, 07 May 2015 23:25:16 -0700 (PDT) X-Received: by 10.112.204.104 with SMTP id kx8mr1668777lbc.72.1431066316507; Thu, 07 May 2015 23:25:16 -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 hn6csp269355lbb; Thu, 7 May 2015 23:25:15 -0700 (PDT) X-Received: by 10.66.192.1 with SMTP id hc1mr4026382pac.38.1431066314772; Thu, 07 May 2015 23:25:14 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t17si5783046pdi.227.2015.05.07.23.25.13; Thu, 07 May 2015 23:25:14 -0700 (PDT) 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 S1751493AbbEHGZN (ORCPT + 11 others); Fri, 8 May 2015 02:25:13 -0400 Received: from mail-pd0-f175.google.com ([209.85.192.175]:33886 "EHLO mail-pd0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751384AbbEHGZM (ORCPT ); Fri, 8 May 2015 02:25:12 -0400 Received: by pdbqa5 with SMTP id qa5so66461483pdb.1 for ; Thu, 07 May 2015 23:25:12 -0700 (PDT) X-Received: by 10.66.145.33 with SMTP id sr1mr3889631pab.41.1431066291870; Thu, 07 May 2015 23:24:51 -0700 (PDT) Received: from localhost ([122.172.243.237]) by mx.google.com with ESMTPSA id fn6sm4000818pab.31.2015.05.07.23.24.50 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 07 May 2015 23:24:51 -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 V3 10/14] cpufreq: Remove cpufreq_update_policy() Date: Fri, 8 May 2015 11:53:53 +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.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 | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 67f0ef711c6d..9dfdd79c9a60 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1117,6 +1117,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; @@ -1201,16 +1205,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 * @@ -1257,15 +1251,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 @@ -1446,11 +1431,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; }