From: Viresh Kumar <viresh.kumar@linaro.org>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org,
Kristen Carlson Accardi <kristen@linux.intel.com>,
open list <linux-kernel@vger.kernel.org>,
Sudeep Holla <sudeep.holla@arm.com>
Subject: Re: [PATCH] cpufreq: pass policy to ->get() driver callback
Date: Fri, 11 Sep 2015 21:48:02 +0530 [thread overview]
Message-ID: <20150911161802.GR9650@linux> (raw)
In-Reply-To: <1725227.VMGKuhRxma@vostro.rjw.lan>
On 10-09-15, 23:36, Rafael J. Wysocki wrote:
> BTW, I wonder how much of the stuff in cpufreq.h can be moved to a local header
> under drivers/cpufreq/. It looks like the majority of it is not used by
> anybody else.
Okay, will check that out and do some cleanup.
> ---
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> Subject: cpufreq: acpi-cpufreq: Use cpufreq_cpu_get_raw() in ->get()
>
> cpufreq_cpu_get() called by get_cur_freq_on_cpu() is overkill,
> because the ->get() callback is always invoked in a context in
> which all of the conditions checked by cpufreq_cpu_get() are
> guaranteed to be satisfied.
>
> Use cpufreq_cpu_get_raw() instead of it and drop the
> corresponding cpufreq_cpu_put() from get_cur_freq_on_cpu().
>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
> drivers/cpufreq/acpi-cpufreq.c | 3 +--
> drivers/cpufreq/cpufreq.c | 2 +-
> include/linux/cpufreq.h | 5 +++++
> 3 files changed, 7 insertions(+), 3 deletions(-)
>
> Index: linux-pm/drivers/cpufreq/acpi-cpufreq.c
> ===================================================================
> --- linux-pm.orig/drivers/cpufreq/acpi-cpufreq.c
> +++ linux-pm/drivers/cpufreq/acpi-cpufreq.c
> @@ -375,12 +375,11 @@ static unsigned int get_cur_freq_on_cpu(
>
> pr_debug("get_cur_freq_on_cpu (%d)\n", cpu);
>
> - policy = cpufreq_cpu_get(cpu);
> + policy = cpufreq_cpu_get_raw(cpu);
> if (unlikely(!policy))
> return 0;
>
> data = policy->driver_data;
> - cpufreq_cpu_put(policy);
> if (unlikely(!data || !data->freq_table))
> return 0;
>
> Index: linux-pm/drivers/cpufreq/cpufreq.c
> ===================================================================
> --- linux-pm.orig/drivers/cpufreq/cpufreq.c
> +++ linux-pm/drivers/cpufreq/cpufreq.c
> @@ -238,13 +238,13 @@ int cpufreq_generic_init(struct cpufreq_
> }
> EXPORT_SYMBOL_GPL(cpufreq_generic_init);
>
> -/* Only for cpufreq core internal use */
> struct cpufreq_policy *cpufreq_cpu_get_raw(unsigned int cpu)
> {
> struct cpufreq_policy *policy = per_cpu(cpufreq_cpu_data, cpu);
>
> return policy && cpumask_test_cpu(cpu, policy->cpus) ? policy : NULL;
> }
> +EXPORT_SYMBOL_GPL(cpufreq_cpu_get_raw);
>
> unsigned int cpufreq_generic_get(unsigned int cpu)
> {
> Index: linux-pm/include/linux/cpufreq.h
> ===================================================================
> --- linux-pm.orig/include/linux/cpufreq.h
> +++ linux-pm/include/linux/cpufreq.h
> @@ -129,9 +129,14 @@ struct cpufreq_policy {
> #define CPUFREQ_SHARED_TYPE_ANY (3) /* Freq can be set from any dependent CPU*/
>
> #ifdef CONFIG_CPU_FREQ
> +struct cpufreq_policy *cpufreq_cpu_get_raw(unsigned int cpu);
> struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu);
> void cpufreq_cpu_put(struct cpufreq_policy *policy);
> #else
> +static inline struct cpufreq_policy *cpufreq_cpu_get_raw(unsigned int cpu)
> +{
> + return NULL;
> +}
> static inline struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu)
> {
> return NULL;
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
--
viresh
next prev parent reply other threads:[~2015-09-11 16:18 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-31 10:44 [PATCH] cpufreq: pass policy to ->get() driver callback Viresh Kumar
2015-09-03 4:45 ` Viresh Kumar
2015-09-04 14:50 ` Rafael J. Wysocki
2015-09-10 1:41 ` Rafael J. Wysocki
2015-09-10 1:22 ` Viresh Kumar
2015-09-10 21:36 ` Rafael J. Wysocki
2015-09-11 16:18 ` Viresh Kumar [this message]
2015-09-15 7:39 ` Viresh Kumar
2015-09-15 7:58 ` Viresh Kumar
2015-09-16 1:30 ` Rafael J. Wysocki
2015-09-10 21:40 ` Rafael J. Wysocki
2015-09-10 21:59 ` Rafael J. Wysocki
2015-09-15 7:54 ` Viresh Kumar
2015-09-16 1:42 ` Rafael J. Wysocki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150911161802.GR9650@linux \
--to=viresh.kumar@linaro.org \
--cc=kristen@linux.intel.com \
--cc=linaro-kernel@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rjw@rjwysocki.net \
--cc=sudeep.holla@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).