diff mbox

[4/6] cpufreq: Add a get_current_driver helper

Message ID 20130128094957.GA6109@pd.tnic (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Borislav Petkov Jan. 28, 2013, 9:49 a.m. UTC
On Mon, Jan 28, 2013 at 10:07:10AM +0530, Viresh Kumar wrote:
> Two minor things here:
> - You placed the routine at bad place. This place is meant for
> freq_table helpers.

Which one would you suggest: CPUFREQ DRIVER INTERFACE?

Btw, this function type splitting looks kinda silly to me. In that same
section there are two which clearly don't belong there:

struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu);
void   cpufreq_cpu_put(struct cpufreq_policy *data);

since they don't have anything to do with freq_table. And since they
return cpufreq_policy, they should be maybe called:

cpufreq_get_cpu_policy
cpufreq_put_cpu_policy

or something more expressive, pertaining to what they actually do. But
they actually get/put the module (inc/dec the module's refcount) *and*
return the cpufreq_policy... whatever, I don't care that much so see
below.

> - And you really don't need extern for function prototypes.

Yeah, Rafael corrected that when committing:

http://git.kernel.org/?p=linux/kernel/git/rafael/linux-pm.git;a=commitdiff;h=fcbf43dcacb0daecffca0f5c862c9d8815108e58

--
From 830eb9ebc715d329229772d11332c50dfd1d9330 Mon Sep 17 00:00:00 2001
From: Borislav Petkov <bp@suse.de>
Date: Mon, 28 Jan 2013 10:38:33 +0100
Subject: [PATCH] cpufreq: Sort function prototypes properly

Move function prototypes to a place where they logically fit better.

Signed-off-by: Borislav Petkov <bp@suse.de>
---
 include/linux/cpufreq.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Viresh Kumar Jan. 28, 2013, 9:52 a.m. UTC | #1
On 28 January 2013 15:19, Borislav Petkov <bp@alien8.de> wrote:
> Which one would you suggest: CPUFREQ DRIVER INTERFACE?

Yes.

> Btw, this function type splitting looks kinda silly to me. In that same
> section there are two which clearly don't belong there:
>
> struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu);
> void   cpufreq_cpu_put(struct cpufreq_policy *data);
>
> since they don't have anything to do with freq_table. And since they
> return cpufreq_policy, they should be maybe called:
>
> cpufreq_get_cpu_policy
> cpufreq_put_cpu_policy
>
> or something more expressive, pertaining to what they actually do. But
> they actually get/put the module (inc/dec the module's refcount) *and*
> return the cpufreq_policy... whatever, I don't care that much so see
> below.

Agree.

> --
> From 830eb9ebc715d329229772d11332c50dfd1d9330 Mon Sep 17 00:00:00 2001
> From: Borislav Petkov <bp@suse.de>
> Date: Mon, 28 Jan 2013 10:38:33 +0100
> Subject: [PATCH] cpufreq: Sort function prototypes properly
>
> Move function prototypes to a place where they logically fit better.
>
> Signed-off-by: Borislav Petkov <bp@suse.de>
> ---
>  include/linux/cpufreq.h | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
> index a018da2d2a7c..f33ace57adb6 100644
> --- a/include/linux/cpufreq.h
> +++ b/include/linux/cpufreq.h
> @@ -308,6 +308,9 @@ __ATTR(_name, 0444, show_##_name, NULL)
>  static struct global_attr _name =              \
>  __ATTR(_name, 0644, show_##_name, store_##_name)
>
> +struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu);
> +void   cpufreq_cpu_put(struct cpufreq_policy *data);
> +const char *cpufreq_get_current_driver(void);
>
>  /*********************************************************************
>   *                        CPUFREQ 2.6. INTERFACE                     *
> @@ -397,8 +400,6 @@ int cpufreq_frequency_table_target(struct cpufreq_policy *policy,
>
>  /* the following 3 funtions are for cpufreq core use only */
>  struct cpufreq_frequency_table *cpufreq_frequency_get_table(unsigned int cpu);
> -struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu);
> -void   cpufreq_cpu_put(struct cpufreq_policy *data);
>
>  /* the following are really really optional */
>  extern struct freq_attr cpufreq_freq_attr_scaling_available_freqs;
> @@ -407,5 +408,4 @@ void cpufreq_frequency_table_get_attr(struct cpufreq_frequency_table *table,
>                                       unsigned int cpu);
>
>  void cpufreq_frequency_table_put_attr(unsigned int cpu);
> -extern const char *cpufreq_get_current_driver(void);
>  #endif /* _LINUX_CPUFREQ_H */

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index a018da2d2a7c..f33ace57adb6 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -308,6 +308,9 @@  __ATTR(_name, 0444, show_##_name, NULL)
 static struct global_attr _name =		\
 __ATTR(_name, 0644, show_##_name, store_##_name)
 
+struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu);
+void   cpufreq_cpu_put(struct cpufreq_policy *data);
+const char *cpufreq_get_current_driver(void);
 
 /*********************************************************************
  *                        CPUFREQ 2.6. INTERFACE                     *
@@ -397,8 +400,6 @@  int cpufreq_frequency_table_target(struct cpufreq_policy *policy,
 
 /* the following 3 funtions are for cpufreq core use only */
 struct cpufreq_frequency_table *cpufreq_frequency_get_table(unsigned int cpu);
-struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu);
-void   cpufreq_cpu_put(struct cpufreq_policy *data);
 
 /* the following are really really optional */
 extern struct freq_attr cpufreq_freq_attr_scaling_available_freqs;
@@ -407,5 +408,4 @@  void cpufreq_frequency_table_get_attr(struct cpufreq_frequency_table *table,
 				      unsigned int cpu);
 
 void cpufreq_frequency_table_put_attr(unsigned int cpu);
-extern const char *cpufreq_get_current_driver(void);
 #endif /* _LINUX_CPUFREQ_H */