From patchwork Mon May 18 05:13:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 48670 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C69CA21411 for ; Mon, 18 May 2015 05:14:10 +0000 (UTC) Received: by wivs14 with SMTP id s14sf18255108wiv.1 for ; Sun, 17 May 2015 22:14: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: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=kqbuCJmzun2gklMfBEh05GVJ1nCraKB/AFxZr2oAK5c=; b=SKmNJSYbsP+9wZlVlX16W9N98/CQtxNDbi7qNXyvCoMTzm11GUH/BKZVytQHGiebmK QLmQ7YHyO5U5zBlU+/lLmv4lYeXcy70RzwiOXcce1URZRt2z9Zsy41WU2ZqKBC2QwN2G 1Aa57kz9up0AcNe5j8APpuOpLZC92u6IoahcYRroRkIrckGrn78edsuimqMrgXVpdVdq 4TgyaAxv3Bqt8c/3FpuCXiDyc/dv2S9v4wPIUmzrkUtVIRYj8UGAymSyNZPwwQTBcgLh fwbOh7yrQK1aNnPeibbr87e3qZcWmdpRHULXB732YlUKyBpPw2lEnR1PeaI1kp3eFkQa T8+g== X-Gm-Message-State: ALoCoQkOrukNhhLSbEve7UpAnYJGv5IJxU0l7e9V3Z9apYdMA02OwiUeBvPxt2T1I0mW+dpNYcSA X-Received: by 10.152.37.101 with SMTP id x5mr16567684laj.5.1431926050072; Sun, 17 May 2015 22:14:10 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.198.229 with SMTP id jf5ls656743lac.56.gmail; Sun, 17 May 2015 22:14:09 -0700 (PDT) X-Received: by 10.112.138.195 with SMTP id qs3mr15368404lbb.47.1431926049929; Sun, 17 May 2015 22:14:09 -0700 (PDT) Received: from mail-la0-f42.google.com (mail-la0-f42.google.com. [209.85.215.42]) by mx.google.com with ESMTPS id jp4si5939281lab.155.2015.05.17.22.14.09 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 17 May 2015 22:14:09 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) client-ip=209.85.215.42; Received: by lagr1 with SMTP id r1so120513485lag.0 for ; Sun, 17 May 2015 22:14:09 -0700 (PDT) X-Received: by 10.152.27.105 with SMTP id s9mr5851070lag.86.1431926049121; Sun, 17 May 2015 22:14:09 -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 hn6csp3711374lbb; Sun, 17 May 2015 22:14:07 -0700 (PDT) X-Received: by 10.66.186.142 with SMTP id fk14mr12601708pac.74.1431926045739; Sun, 17 May 2015 22:14:05 -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.14.04; Sun, 17 May 2015 22:14:05 -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 S1751932AbbERFOD (ORCPT + 11 others); Mon, 18 May 2015 01:14:03 -0400 Received: from mail-pd0-f182.google.com ([209.85.192.182]:36261 "EHLO mail-pd0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751285AbbERFOB (ORCPT ); Mon, 18 May 2015 01:14:01 -0400 Received: by pdfh10 with SMTP id h10so133400077pdf.3 for ; Sun, 17 May 2015 22:14:01 -0700 (PDT) X-Received: by 10.66.146.6 with SMTP id sy6mr40050074pab.150.1431926041271; Sun, 17 May 2015 22:14:01 -0700 (PDT) Received: from localhost ([122.167.226.34]) by mx.google.com with ESMTPSA id pj8sm8615376pdb.20.2015.05.17.22.14.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 17 May 2015 22:14:00 -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 03/14] cpufreq: Get rid of cpufreq_cpu_data_fallback Date: Mon, 18 May 2015 10:43:26 +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.42 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: , We can extract the same information from cpufreq_cpu_data as it is also available for inactive policies now. And so don't need cpufreq_cpu_data_fallback anymore. Also add a WARN_ON() for the case where we try to restore from an active policy. Acked-by: Saravana Kannan Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq.c | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index e899a5446d0e..eb0c3a802b14 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -101,7 +101,6 @@ static LIST_HEAD(cpufreq_governor_list); */ static struct cpufreq_driver *cpufreq_driver; static DEFINE_PER_CPU(struct cpufreq_policy *, cpufreq_cpu_data); -static DEFINE_PER_CPU(struct cpufreq_policy *, cpufreq_cpu_data_fallback); static DEFINE_RWLOCK(cpufreq_driver_lock); DEFINE_MUTEX(cpufreq_governor_lock); @@ -1081,13 +1080,14 @@ static struct cpufreq_policy *cpufreq_policy_restore(unsigned int cpu) unsigned long flags; read_lock_irqsave(&cpufreq_driver_lock, flags); - - policy = per_cpu(cpufreq_cpu_data_fallback, cpu); - + policy = per_cpu(cpufreq_cpu_data, cpu); read_unlock_irqrestore(&cpufreq_driver_lock, flags); - if (policy) + if (likely(policy)) { + /* Policy should be inactive here */ + WARN_ON(!policy_is_inactive(policy)); policy->governor = NULL; + } return policy; } @@ -1383,11 +1383,8 @@ static int cpufreq_add_dev(struct device *dev, struct subsys_interface *sif) if (cpufreq_driver->exit) cpufreq_driver->exit(policy); err_set_policy_cpu: - if (recover_policy) { - /* Do not leave stale fallback data behind. */ - per_cpu(cpufreq_cpu_data_fallback, cpu) = NULL; + if (recover_policy) cpufreq_policy_put_kobj(policy); - } cpufreq_policy_free(policy); nomem_out: @@ -1401,21 +1398,11 @@ static int __cpufreq_remove_dev_prepare(struct device *dev, { unsigned int cpu = dev->id, cpus; int ret; - unsigned long flags; struct cpufreq_policy *policy; pr_debug("%s: unregistering CPU %u\n", __func__, cpu); - write_lock_irqsave(&cpufreq_driver_lock, flags); - policy = cpufreq_cpu_get_raw(cpu); - - /* Save the policy somewhere when doing a light-weight tear-down */ - if (cpufreq_suspended) - per_cpu(cpufreq_cpu_data_fallback, cpu) = policy; - - write_unlock_irqrestore(&cpufreq_driver_lock, flags); - if (!policy) { pr_debug("%s: No cpu_data found\n", __func__); return -EINVAL;