From patchwork Tue Aug 6 17:23:08 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 18809 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ye0-f198.google.com (mail-ye0-f198.google.com [209.85.213.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3115C25DF6 for ; Tue, 6 Aug 2013 17:24:22 +0000 (UTC) Received: by mail-ye0-f198.google.com with SMTP id m12sf705424yen.9 for ; Tue, 06 Aug 2013 10:24:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-gm-message-state:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:in-reply-to:references :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=pAYwe8fIopvKdZxQvrWAEJZxDLwBsJOw4ioGBy+S0AE=; b=TO+IFxVZqoOXw3EgEOUxg8C24+BdyzMjOoqtTNnANsoGhh0r4Q3hzYq7n4MUo6Ab6Q cljGOfmNKdC1wAhbTZ88WUZTPAYClXBVTWQK0QRpmo+ihEjJxriarifyUsgoRDmtKono 3oHtAXt8LYUYqI7VCENjrefFVzDT/13ajlKWt7YB5pXWE9UG/DiTAOmRqQdA6xHPz7Zc +ApVVQCohOia8IKe0PKt/G01ju40SRKwXmJtwwzCF7q7AUbx3+bFzMzA6gKGATwKviiZ 2yUbknyfNYJDMg0eq6U4NeDS+6+S2vGtG+26VnOCz+TIfUAMlFZ91+V5zn8GR0XSZtIQ oJEA== X-Received: by 10.236.92.7 with SMTP id i7mr835630yhf.52.1375809861974; Tue, 06 Aug 2013 10:24:21 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.121.195 with SMTP id lm3ls330293qeb.89.gmail; Tue, 06 Aug 2013 10:24:21 -0700 (PDT) X-Received: by 10.58.233.173 with SMTP id tx13mr711650vec.31.1375809861820; Tue, 06 Aug 2013 10:24:21 -0700 (PDT) Received: from mail-ve0-f181.google.com (mail-ve0-f181.google.com [209.85.128.181]) by mx.google.com with ESMTPS id vg3si539408vec.24.2013.08.06.10.24.21 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 06 Aug 2013 10:24:21 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.181 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.181; Received: by mail-ve0-f181.google.com with SMTP id jz10so699620veb.26 for ; Tue, 06 Aug 2013 10:24:21 -0700 (PDT) X-Gm-Message-State: ALoCoQn9orn/VRJnmyGMvT/QefQytBvITaO4m6wkpdHP5Ul88pVgv/wTu+Kw3F+D61JvymyYqFcn X-Received: by 10.221.47.193 with SMTP id ut1mr710879vcb.8.1375809861675; Tue, 06 Aug 2013 10:24:21 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.221.11.8 with SMTP id pc8csp157145vcb; Tue, 6 Aug 2013 10:24:21 -0700 (PDT) X-Received: by 10.68.219.33 with SMTP id pl1mr2643637pbc.147.1375809860744; Tue, 06 Aug 2013 10:24:20 -0700 (PDT) Received: from mail-pd0-f169.google.com (mail-pd0-f169.google.com [209.85.192.169]) by mx.google.com with ESMTPS id yt8si1222220pab.119.2013.08.06.10.24.20 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 06 Aug 2013 10:24:20 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.192.169 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.192.169; Received: by mail-pd0-f169.google.com with SMTP id y11so508728pdj.14 for ; Tue, 06 Aug 2013 10:24:20 -0700 (PDT) X-Received: by 10.66.235.39 with SMTP id uj7mr4405640pac.122.1375809860340; Tue, 06 Aug 2013 10:24:20 -0700 (PDT) Received: from localhost ([122.172.193.46]) by mx.google.com with ESMTPSA id il4sm3102152pbb.36.2013.08.06.10.24.15 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 06 Aug 2013 10:24:19 -0700 (PDT) From: Viresh Kumar To: rjw@sisk.pl Cc: linaro-kernel@lists.linaro.org, patches@linaro.org, cpufreq@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, srivatsa.bhat@linux.vnet.ibm.com, Lukasz Majewski , Myungjoo Ham , Viresh Kumar Subject: [PATCH V2 06/11] cpufreq: Store cpufreq policies in a list Date: Tue, 6 Aug 2013 22:53:08 +0530 Message-Id: <614e2013bbd3833cc17d0a0a1d49cd11d43cf1d3.1375809311.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e In-Reply-To: References: In-Reply-To: References: X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.181 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Lukasz Majewski Policies available in a cpufreq framework are now linked together. They are accessible via cpufreq_policy_list defined at cpufreq core. Signed-off-by: Lukasz Majewski Signed-off-by: Myungjoo Ham Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq.c | 11 +++++++++++ include/linux/cpufreq.h | 1 + 2 files changed, 12 insertions(+) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 9e83d91..f5999c4 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -40,6 +40,7 @@ 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); static DEFINE_MUTEX(cpufreq_governor_lock); +static LIST_HEAD(cpufreq_policy_list); #ifdef CONFIG_HOTPLUG_CPU /* This one keeps track of the previously set governor of a removed CPU */ @@ -964,6 +965,12 @@ err_free_policy: static void cpufreq_policy_free(struct cpufreq_policy *policy) { + unsigned long flags; + + write_lock_irqsave(&cpufreq_driver_lock, flags); + list_del(&policy->policy_list); + write_unlock_irqrestore(&cpufreq_driver_lock, flags); + free_cpumask_var(policy->related_cpus); free_cpumask_var(policy->cpus); kfree(policy); @@ -1077,6 +1084,10 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif, ret = cpufreq_add_dev_interface(policy, dev); if (ret) goto err_out_unregister; + + write_lock_irqsave(&cpufreq_driver_lock, flags); + list_add(&policy->policy_list, &cpufreq_policy_list); + write_unlock_irqrestore(&cpufreq_driver_lock, flags); } cpufreq_init_policy(policy); diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 2920892..431a05d 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -82,6 +82,7 @@ struct cpufreq_policy { struct cpufreq_real_policy user_policy; + struct list_head policy_list; struct kobject kobj; struct completion kobj_unregister; int transition_ongoing; /* Tracks transition status */