From patchwork Sat May 23 03:45: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: 48915 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8F7532121F for ; Sat, 23 May 2015 03:46:11 +0000 (UTC) Received: by lbbqj7 with SMTP id qj7sf9791641lbb.1 for ; Fri, 22 May 2015 20:46:10 -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:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=MD9fvkAiVDXAtVxPpCLlE+XELwCNV2vZ2GKrfgSpuRA=; b=M1rjCzvfj07MfFGvp3RmXswB9U3OIHmnkElsQjzWyhnSZrsMxE35NFoWR2lbfeJxym ae6ClKXxCfF1p0AGFk8+fJU41il40YC5s+PmT5w3hkSJvABLT1sDZ9hXRj2s3AcIiHve 63ObinoP8d8IA7I4KtQNVTzU0bi4AFqc0hHDbweMW9Dzk4B1HGurmHWOjBuTBbdejeoO E6+4YYI3KZVi4jmNEcbjKQLfa8bLD+nGsd0K6eQVpk//Lbtc4CeLIMSe5paO0t6bM/m9 Eb1nfc33L8mY0b0taNhX3kFc8d4b6MqY5/snE7iGQPwsCUaaZdU4Yl2e3EmP0IoEatQh uGaQ== X-Gm-Message-State: ALoCoQkVU+mvHvUz3ZcXo2fO7LgmUREt6liQAEzVHqo6DupF0IPOjhgabgqogje2CGCtA+2tWTEH X-Received: by 10.180.106.136 with SMTP id gu8mr6978970wib.6.1432352770511; Fri, 22 May 2015 20:46:10 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.88.3 with SMTP id bc3ls596246lab.22.gmail; Fri, 22 May 2015 20:46:10 -0700 (PDT) X-Received: by 10.112.135.131 with SMTP id ps3mr8920438lbb.84.1432352770345; Fri, 22 May 2015 20:46:10 -0700 (PDT) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id u1si2852511lau.12.2015.05.22.20.46.10 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 May 2015 20:46:10 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by lagv1 with SMTP id v1so23468417lag.3 for ; Fri, 22 May 2015 20:46:10 -0700 (PDT) X-Received: by 10.152.4.137 with SMTP id k9mr8854111lak.29.1432352770207; Fri, 22 May 2015 20:46:10 -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 hn6csp278709lbb; Fri, 22 May 2015 20:46:07 -0700 (PDT) X-Received: by 10.70.136.33 with SMTP id px1mr21061809pdb.106.1432352767122; Fri, 22 May 2015 20:46:07 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v5si6157877pdb.7.2015.05.22.20.46.06; Fri, 22 May 2015 20:46:07 -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 S1757036AbbEWDqF (ORCPT + 11 others); Fri, 22 May 2015 23:46:05 -0400 Received: from mail-pd0-f181.google.com ([209.85.192.181]:34542 "EHLO mail-pd0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756530AbbEWDqE (ORCPT ); Fri, 22 May 2015 23:46:04 -0400 Received: by pdbnk13 with SMTP id nk13so32961815pdb.1 for ; Fri, 22 May 2015 20:46:04 -0700 (PDT) X-Received: by 10.70.41.165 with SMTP id g5mr21075588pdl.143.1432352764397; Fri, 22 May 2015 20:46:04 -0700 (PDT) Received: from localhost ([122.167.226.34]) by mx.google.com with ESMTPSA id ro8sm3479488pab.23.2015.05.22.20.46.02 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 22 May 2015 20:46:02 -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: Date: Sat, 23 May 2015 09:15:53 +0530 Message-Id: <59ebb79018c6a4d86623614fe3e44a6de8592c6c.1431924457.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.4.0 In-Reply-To: <93a0104d11e5f75825672f0c59b8eec76c72d0e0.1431924457.git.viresh.kumar@linaro.org> 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.49 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: , Subject: [PATCH V6 10/14] cpufreq: Remove cpufreq_update_policy() 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 --- V5->V6: - Merged v4 9/14, into this one after some updates. - Keep separate routines to add/remove symlinks. 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 663a934259a4..a791fe6920dc 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1126,6 +1126,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; @@ -1210,16 +1214,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 * @@ -1278,15 +1272,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 @@ -1467,11 +1452,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; }