From patchwork Thu Feb 19 11:32:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 44824 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 205E321554 for ; Thu, 19 Feb 2015 11:34:10 +0000 (UTC) Received: by lams18 with SMTP id s18sf4688614lam.1 for ; Thu, 19 Feb 2015 03:34:08 -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=sXDOB0dGaRdg1mmhEtMEzfZXynMR6ybKdadQ1b9N9JA=; b=OhkXMwoDs+Rrob5MW0Fu0iHZ3lzleOeYScElJ0BZR91hnR5vEiXDZBBOnTt8Y4Vj34 l1znkG7Q4ETlpOR5StvwySBPU3PtQnJdRkbXYAd9hgZeIkLmTXMU36cOjAVaeXzsY3KT LjmP7FXYCGv9tvPOEcvq2eGkqLj46/XOo8rYIJgNHADTyFnePb0cH/tSg2FLBkJensSL 90m3SvdcRyrXpHmeMtCqM/izGYvyfaEcmVvomJKs58jKmkFEwhu3o+TAyVWZlay8rPe9 LUhZqRBpbgt9Wp1V1UBPWnUmxF0AM+YW+SHBaMs8m7Oz5UtnvPLH7b+ZQ7xYAPnBdTYR I1Cw== X-Gm-Message-State: ALoCoQmdtbMTslShHNYawAUfnNPKq06fP/QhuNZg8kbZ0ng4m13iljoJEPyJTBU1lDW2m653rws6 X-Received: by 10.112.199.69 with SMTP id ji5mr520652lbc.0.1424345648733; Thu, 19 Feb 2015 03:34:08 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.153.7.75 with SMTP id da11ls131874lad.95.gmail; Thu, 19 Feb 2015 03:34:08 -0800 (PST) X-Received: by 10.152.121.66 with SMTP id li2mr3682323lab.40.1424345648576; Thu, 19 Feb 2015 03:34:08 -0800 (PST) Received: from mail-la0-f53.google.com (mail-la0-f53.google.com. [209.85.215.53]) by mx.google.com with ESMTPS id ru4si14563652lbb.178.2015.02.19.03.34.08 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Feb 2015 03:34:08 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.53 as permitted sender) client-ip=209.85.215.53; Received: by labpv20 with SMTP id pv20so6958049lab.8 for ; Thu, 19 Feb 2015 03:34:08 -0800 (PST) X-Received: by 10.112.26.110 with SMTP id k14mr3459104lbg.29.1424345648489; Thu, 19 Feb 2015 03:34:08 -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 h5csp431732lbj; Thu, 19 Feb 2015 03:34:07 -0800 (PST) X-Received: by 10.69.27.15 with SMTP id jc15mr727958pbd.126.1424345646183; Thu, 19 Feb 2015 03:34:06 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c12si28454761pdm.248.2015.02.19.03.34.04; Thu, 19 Feb 2015 03:34:06 -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 S1753414AbbBSLd6 (ORCPT + 11 others); Thu, 19 Feb 2015 06:33:58 -0500 Received: from mail-pd0-f180.google.com ([209.85.192.180]:37243 "EHLO mail-pd0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753385AbbBSLd5 (ORCPT ); Thu, 19 Feb 2015 06:33:57 -0500 Received: by pdbfl12 with SMTP id fl12so8300836pdb.4 for ; Thu, 19 Feb 2015 03:33:56 -0800 (PST) X-Received: by 10.70.56.102 with SMTP id z6mr7078049pdp.18.1424345636852; Thu, 19 Feb 2015 03:33:56 -0800 (PST) Received: from localhost ([122.172.249.58]) by mx.google.com with ESMTPSA id ep2sm23380542pbc.78.2015.02.19.03.33.55 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 19 Feb 2015 03:33:56 -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 09/20] cpufreq: Get rid of cpufreq_cpu_data_fallback Date: Thu, 19 Feb 2015 17:02:11 +0530 Message-Id: <931526f13b5213db72a6f6cc31730ee82ac9b780.1424345053.git.viresh.kumar@linaro.org> 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.215.53 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. 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 e27b2a7bd9b3..f849b2a33d3e 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -112,7 +112,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); @@ -1092,13 +1091,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; } @@ -1394,11 +1394,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: @@ -1412,21 +1409,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;