Re: [PATCH 4/6] cpufreq: Add a get_current_driver helper
On 28 January 2013 15:19, Borislav Petkov 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 > 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 > --- > 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 4/6] cpufreq: Add a get_current_driver helper
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 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 --- 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 */ -- 1.8.1.rc3 -- Regards/Gruss, Boris. Sent from a fat crate under my desk. Formatting is fine. -- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 4/6] cpufreq: Add a get_current_driver helper
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 b...@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 b...@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 */ -- 1.8.1.rc3 -- Regards/Gruss, Boris. Sent from a fat crate under my desk. Formatting is fine. -- -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 4/6] cpufreq: Add a get_current_driver helper
On 28 January 2013 15:19, Borislav Petkov b...@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 b...@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 b...@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.ku...@linaro.org -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 4/6] cpufreq: Add a get_current_driver helper
On Sun, Jan 20, 2013 at 3:54 PM, Borislav Petkov wrote: > From: Borislav Petkov > > Add a helper function to return cpufreq_driver->name. > > Signed-off-by: Borislav Petkov > --- > drivers/cpufreq/cpufreq.c | 14 ++ > include/linux/cpufreq.h | 1 + > 2 files changed, 15 insertions(+) > > diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c > index 1f93dbd72355..6ed3c1377caf 100644 > --- a/drivers/cpufreq/cpufreq.c > +++ b/drivers/cpufreq/cpufreq.c > @@ -1386,6 +1386,20 @@ static struct syscore_ops cpufreq_syscore_ops = { > .resume = cpufreq_bp_resume, > }; > > +/** > + * cpufreq_get_current_driver - return current driver's name > + * > + * Return the name string of the currently loaded cpufreq driver > + * or NULL, if none. > + */ > +const char *cpufreq_get_current_driver(void) > +{ > + if (cpufreq_driver) > + return cpufreq_driver->name; > + > + return NULL; > +} > +EXPORT_SYMBOL_GPL(cpufreq_get_current_driver); > > /* > * NOTIFIER LISTS INTERFACE * > diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h > index a55b88eaf96a..a018da2d2a7c 100644 > --- a/include/linux/cpufreq.h > +++ b/include/linux/cpufreq.h > @@ -407,4 +407,5 @@ 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); Two minor things here: - You placed the routine at bad place. This place is meant for freq_table helpers. - And you really don't need extern for function prototypes. And after fixing these, feel free to add Acked-by: Viresh Kumar -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 4/6] cpufreq: Add a get_current_driver helper
On Sun, Jan 20, 2013 at 3:54 PM, Borislav Petkov b...@alien8.de wrote: From: Borislav Petkov b...@suse.de Add a helper function to return cpufreq_driver-name. Signed-off-by: Borislav Petkov b...@suse.de --- drivers/cpufreq/cpufreq.c | 14 ++ include/linux/cpufreq.h | 1 + 2 files changed, 15 insertions(+) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 1f93dbd72355..6ed3c1377caf 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1386,6 +1386,20 @@ static struct syscore_ops cpufreq_syscore_ops = { .resume = cpufreq_bp_resume, }; +/** + * cpufreq_get_current_driver - return current driver's name + * + * Return the name string of the currently loaded cpufreq driver + * or NULL, if none. + */ +const char *cpufreq_get_current_driver(void) +{ + if (cpufreq_driver) + return cpufreq_driver-name; + + return NULL; +} +EXPORT_SYMBOL_GPL(cpufreq_get_current_driver); /* * NOTIFIER LISTS INTERFACE * diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index a55b88eaf96a..a018da2d2a7c 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -407,4 +407,5 @@ 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); Two minor things here: - You placed the routine at bad place. This place is meant for freq_table helpers. - And you really don't need extern for function prototypes. And after fixing these, feel free to add Acked-by: Viresh Kumar viresh.ku...@linaro.org -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 4/6] cpufreq: Add a get_current_driver helper
From: Borislav Petkov Add a helper function to return cpufreq_driver->name. Signed-off-by: Borislav Petkov --- drivers/cpufreq/cpufreq.c | 14 ++ include/linux/cpufreq.h | 1 + 2 files changed, 15 insertions(+) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 1f93dbd72355..6ed3c1377caf 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1386,6 +1386,20 @@ static struct syscore_ops cpufreq_syscore_ops = { .resume = cpufreq_bp_resume, }; +/** + * cpufreq_get_current_driver - return current driver's name + * + * Return the name string of the currently loaded cpufreq driver + * or NULL, if none. + */ +const char *cpufreq_get_current_driver(void) +{ + if (cpufreq_driver) + return cpufreq_driver->name; + + return NULL; +} +EXPORT_SYMBOL_GPL(cpufreq_get_current_driver); /* * NOTIFIER LISTS INTERFACE * diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index a55b88eaf96a..a018da2d2a7c 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -407,4 +407,5 @@ 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 */ -- 1.8.1.rc3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 4/6] cpufreq: Add a get_current_driver helper
From: Borislav Petkov b...@suse.de Add a helper function to return cpufreq_driver-name. Signed-off-by: Borislav Petkov b...@suse.de --- drivers/cpufreq/cpufreq.c | 14 ++ include/linux/cpufreq.h | 1 + 2 files changed, 15 insertions(+) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 1f93dbd72355..6ed3c1377caf 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1386,6 +1386,20 @@ static struct syscore_ops cpufreq_syscore_ops = { .resume = cpufreq_bp_resume, }; +/** + * cpufreq_get_current_driver - return current driver's name + * + * Return the name string of the currently loaded cpufreq driver + * or NULL, if none. + */ +const char *cpufreq_get_current_driver(void) +{ + if (cpufreq_driver) + return cpufreq_driver-name; + + return NULL; +} +EXPORT_SYMBOL_GPL(cpufreq_get_current_driver); /* * NOTIFIER LISTS INTERFACE * diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index a55b88eaf96a..a018da2d2a7c 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -407,4 +407,5 @@ 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 */ -- 1.8.1.rc3 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/