From patchwork Thu Feb 19 11:32:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 44829 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 1576321554 for ; Thu, 19 Feb 2015 11:34:36 +0000 (UTC) Received: by mail-wi0-f199.google.com with SMTP id bs8sf5182498wib.2 for ; Thu, 19 Feb 2015 03:34:35 -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=T6G1FeidFtz8L9laquRVaiMogM0aywF8UJtgeVEiamM=; b=FjpevjS8stMfYnQUU54RT3YifF4tvxEd0cxQsveZNYivN5lhlsMqLqJcqqVV5lqaBc li2Rt5ObCgufJfpENTZ/ZiEmw7zfUWScRCiAP/Vc9h9x9QKoWp5zZMQZCaQThZele8RQ 6NDVQj1g6boE7wCcBQLrtSaRdcCin1Lx64ORwoCX7jfLSgQYA5HHkDrQsPVfkUlyzkXN l8lXdk37agKunFr7fLEJeJ3IjC4kCWCFqzTnJRUgvce/9hpI4OFiVIAxqf/ogj1KiHuD cZm3UxsNtrRzwWct4IbFnN1W6WIV2gmrm4eCF57IPgukC+m3oS0CkDicY+teI8Zit2Ba HOUA== X-Gm-Message-State: ALoCoQmlvl8jiCP4WVk9VXcpA9hbfUjz7jcfWc7jKX+vb+0CPtt/dJl/o/1qfyQAaAdWpvXMNvXf X-Received: by 10.152.45.7 with SMTP id i7mr508340lam.9.1424345675099; Thu, 19 Feb 2015 03:34:35 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.87.231 with SMTP id bb7ls143500lab.50.gmail; Thu, 19 Feb 2015 03:34:34 -0800 (PST) X-Received: by 10.152.9.230 with SMTP id d6mr1901319lab.16.1424345674878; Thu, 19 Feb 2015 03:34:34 -0800 (PST) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com. [209.85.217.177]) by mx.google.com with ESMTPS id 5si11812939lal.85.2015.02.19.03.34.34 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Feb 2015 03:34:34 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) client-ip=209.85.217.177; Received: by lbdu10 with SMTP id u10so6804507lbd.7 for ; Thu, 19 Feb 2015 03:34:34 -0800 (PST) X-Received: by 10.112.135.196 with SMTP id pu4mr3445955lbb.41.1424345674758; Thu, 19 Feb 2015 03:34:34 -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 h5csp431931lbj; Thu, 19 Feb 2015 03:34:33 -0800 (PST) X-Received: by 10.68.65.36 with SMTP id u4mr6623724pbs.91.1424345672659; Thu, 19 Feb 2015 03:34:32 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cr5si2420509pdb.146.2015.02.19.03.34.31; Thu, 19 Feb 2015 03:34:32 -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 S1753478AbbBSLe2 (ORCPT + 11 others); Thu, 19 Feb 2015 06:34:28 -0500 Received: from mail-pa0-f48.google.com ([209.85.220.48]:36841 "EHLO mail-pa0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753418AbbBSLe0 (ORCPT ); Thu, 19 Feb 2015 06:34:26 -0500 Received: by pabkq14 with SMTP id kq14so8893002pab.3 for ; Thu, 19 Feb 2015 03:34:25 -0800 (PST) X-Received: by 10.66.232.230 with SMTP id tr6mr6799463pac.152.1424345665889; Thu, 19 Feb 2015 03:34:25 -0800 (PST) Received: from localhost ([122.172.249.58]) by mx.google.com with ESMTPSA id pm2sm23378267pbb.81.2015.02.19.03.34.22 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 19 Feb 2015 03:34:22 -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 V2 16/20] cpufreq: Remove cpufreq_update_policy() Date: Thu, 19 Feb 2015 17:02:18 +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.177 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 29cb952960fa..814a8c70e2b1 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1116,6 +1116,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; @@ -1200,16 +1204,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 * @@ -1256,15 +1250,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 @@ -1445,11 +1430,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; }