From patchwork Sat Aug 3 11:49:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 18751 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f69.google.com (mail-yh0-f69.google.com [209.85.213.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id ACEF023981 for ; Sat, 3 Aug 2013 11:50:31 +0000 (UTC) Received: by mail-yh0-f69.google.com with SMTP id i72sf2220077yha.4 for ; Sat, 03 Aug 2013 04:50:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-beenthere:x-forwarded-to:x-forwarded-for :delivered-to:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:in-reply-to:references:x-gm-message-state :x-removed-original-auth:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=WknxVzxqCNMAQf+5qxmbxOmLX+sLOhnqiMWsJgWh1Mo=; b=PWkyjAZa8JS86ECKt9DDsLJTgam8KqzQNbMxy/fqN5CrKeRm8nlhVc98SxrDU7Ii3C 6NKv3FKeLYq26NvgLKyyMmLYudILnefL6DnvST84QRnnC2I+FMsH8KDSdtYMpR9GLsgr bHkFwD1cSvSa+7eHseMftVKWd2CMqwTsEfA36nCi7A7U4Xxwp514AQWIy3CdYvKigzE8 tLx6JgF49xZZi/klXgoPXyfVL0nr6UEBIy5lco6kUQu81hJM6180CgZHUiQ8Cz5F+V1j S1ezJ2y6zAgWlO0l8tG0mff94Xs7hWkTEw1RjmgiUYYgfYUUoprXBPrPeYQanv5vS4sQ SBXA== X-Received: by 10.236.220.5 with SMTP id n5mr4665772yhp.21.1375530631488; Sat, 03 Aug 2013 04:50:31 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.0.41 with SMTP id 9ls2001503qeb.15.gmail; Sat, 03 Aug 2013 04:50:31 -0700 (PDT) X-Received: by 10.220.237.208 with SMTP id kp16mr3446957vcb.4.1375530631375; Sat, 03 Aug 2013 04:50:31 -0700 (PDT) Received: from mail-vb0-f42.google.com (mail-vb0-f42.google.com [209.85.212.42]) by mx.google.com with ESMTPS id zj7si2967775vdb.142.2013.08.03.04.50.31 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 03 Aug 2013 04:50:31 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.42 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.42; Received: by mail-vb0-f42.google.com with SMTP id e12so1532719vbg.1 for ; Sat, 03 Aug 2013 04:50:31 -0700 (PDT) X-Received: by 10.221.47.193 with SMTP id ut1mr3361467vcb.8.1375530631240; Sat, 03 Aug 2013 04:50:31 -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 pc8csp466vcb; Sat, 3 Aug 2013 04:50:30 -0700 (PDT) X-Received: by 10.68.163.2 with SMTP id ye2mr8348903pbb.197.1375530630283; Sat, 03 Aug 2013 04:50:30 -0700 (PDT) Received: from mail-pa0-f46.google.com (mail-pa0-f46.google.com [209.85.220.46]) by mx.google.com with ESMTPS id tw4si10487949pbc.91.2013.08.03.04.50.29 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 03 Aug 2013 04:50:30 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.46 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.220.46; Received: by mail-pa0-f46.google.com with SMTP id fa1so1586009pad.5 for ; Sat, 03 Aug 2013 04:50:29 -0700 (PDT) X-Received: by 10.66.233.37 with SMTP id tt5mr15100810pac.95.1375530629872; Sat, 03 Aug 2013 04:50:29 -0700 (PDT) Received: from localhost ([122.172.193.46]) by mx.google.com with ESMTPSA id ep4sm15818171pbd.35.2013.08.03.04.50.25 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 03 Aug 2013 04:50:29 -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, l.majewski@samsung.com, Myungjoo Ham , Viresh Kumar Subject: [PATCH 06/10] cpufreq: Store cpufreq policies in a list Date: Sat, 3 Aug 2013 17:19:24 +0530 Message-Id: X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e In-Reply-To: References: In-Reply-To: References: X-Gm-Message-State: ALoCoQkhlMY/8VZYzNcdExTMw/5EH1xarOcUbm7xX9d+61F0Ir+CqWg2+B9tsRMWaaEhfs5bNsQ+ 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.212.42 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 496e31c..4c3aef0 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -39,6 +39,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 */ @@ -963,6 +964,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); @@ -1076,6 +1083,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 9876712..d272fa4 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 */