From patchwork Fri May 8 06:23:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 48147 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CA3E22121F for ; Fri, 8 May 2015 06:24:48 +0000 (UTC) Received: by layy10 with SMTP id y10sf20139794lay.0 for ; Thu, 07 May 2015 23:24:47 -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=EEhGPoxWYJvVs7p60JREm27uhPh2B6zm6NNfQ47c8pA=; b=Kr+6h0x89rzhIrfkqlseNzqrOGAXwn+RvnLzmswdV3j0D/k/YXrkVqqGDAkc256HZL 0sV2BelmTJdYWlwGp1AUR3uPc3fLX6z+Aa1p/11aSCqu6Pxxz4KgELr+4bzH6sLCE5V9 PUX3WwKmXE2fUL6zod5RmPco8GRBSCN/tediK3xYRnWcPwop/cgfrlhYlTD7zB5GDigk ZJW9nRvjhBkv7eqbaH2O5zbbwve+flJZAFJ30rlRHBBZi3+jw47XGqKKt1jk0mEXihvk IUUsmc6dDd0swxXLxFwyLUwPlWnTk5v9YjFgrij+2h8LIRoAK7y4ednvvQ61tknqv0iK RlIQ== X-Gm-Message-State: ALoCoQmBvjEEC5H21AhgwvIkveIxy0lDMJzGAsd0IeON3et3ix3hyxlDHxHdavvhUsrfN74KTNpp X-Received: by 10.180.160.197 with SMTP id xm5mr460801wib.1.1431066287787; Thu, 07 May 2015 23:24:47 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.36.34 with SMTP id n2ls277328laj.15.gmail; Thu, 07 May 2015 23:24:47 -0700 (PDT) X-Received: by 10.152.204.40 with SMTP id kv8mr1632716lac.113.1431066287629; Thu, 07 May 2015 23:24:47 -0700 (PDT) Received: from mail-lb0-f175.google.com (mail-lb0-f175.google.com. [209.85.217.175]) by mx.google.com with ESMTPS id au9si2661485lbc.168.2015.05.07.23.24.47 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 May 2015 23:24:47 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.175 as permitted sender) client-ip=209.85.217.175; Received: by lbbuc2 with SMTP id uc2so46412153lbb.2 for ; Thu, 07 May 2015 23:24:47 -0700 (PDT) X-Received: by 10.112.204.72 with SMTP id kw8mr1697821lbc.88.1431066287495; Thu, 07 May 2015 23:24:47 -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 hn6csp269195lbb; Thu, 7 May 2015 23:24:46 -0700 (PDT) X-Received: by 10.70.88.170 with SMTP id bh10mr4037675pdb.62.1431066284225; Thu, 07 May 2015 23:24:44 -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.24.43; Thu, 07 May 2015 23:24:44 -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 S1751238AbbEHGYm (ORCPT + 11 others); Fri, 8 May 2015 02:24:42 -0400 Received: from mail-pd0-f173.google.com ([209.85.192.173]:33518 "EHLO mail-pd0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751196AbbEHGYm (ORCPT ); Fri, 8 May 2015 02:24:42 -0400 Received: by pdbnk13 with SMTP id nk13so66943805pdb.0 for ; Thu, 07 May 2015 23:24:42 -0700 (PDT) X-Received: by 10.70.126.225 with SMTP id nb1mr3981551pdb.71.1431066264628; Thu, 07 May 2015 23:24:24 -0700 (PDT) Received: from localhost ([122.172.243.237]) by mx.google.com with ESMTPSA id by8sm4003663pab.16.2015.05.07.23.24.23 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 07 May 2015 23:24:23 -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 03/14] cpufreq: Get rid of cpufreq_cpu_data_fallback Date: Fri, 8 May 2015 11:53:46 +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.175 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 c802ded03595..b60311fe207f 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -113,7 +113,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); @@ -1093,13 +1092,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; } @@ -1395,11 +1395,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: @@ -1413,21 +1410,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;