From mboxrd@z Thu Jan 1 00:00:00 1970 From: Saravana Kannan Subject: Re: [PATCH 02/18] cpufreq: Create for_each_policy() Date: Tue, 03 Feb 2015 14:22:25 -0800 Message-ID: <54D14A21.3010007@codeaurora.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from smtp.codeaurora.org ([198.145.11.231]:42437 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751794AbbBCWW1 (ORCPT ); Tue, 3 Feb 2015 17:22:27 -0500 In-Reply-To: Sender: linux-pm-owner@vger.kernel.org List-Id: linux-pm@vger.kernel.org To: Viresh Kumar Cc: Rafael Wysocki , linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, sboyd@codeaurora.org, prarit@redhat.com On 01/27/2015 12:36 AM, Viresh Kumar wrote: > To make code more readable and less error prone, lets create a helper macro for > iterating over all active policies. > > Signed-off-by: Viresh Kumar > --- > drivers/cpufreq/cpufreq.c | 15 ++++++++++----- > 1 file changed, 10 insertions(+), 5 deletions(-) > > diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c > index 72990ba59fad..9dfefb8ece6d 100644 > --- a/drivers/cpufreq/cpufreq.c > +++ b/drivers/cpufreq/cpufreq.c > @@ -31,6 +31,12 @@ > #include > #include > > +/* Macros to iterate over lists */ > +/* Iterate over online CPUs policies */ > +static LIST_HEAD(cpufreq_policy_list); > +#define for_each_policy(__policy) \ > + list_for_each_entry(__policy, &cpufreq_policy_list, policy_list) > + Could you "export" this macro/list so that it's usable by other clients of cpufreq too? If a driver wants to examine all the policies today, it has to do "for_each_cpu" and then try to get the policy for each CPU. This seems nicer. -Saravana -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation