Message ID | 1358677470-17394-5-git-send-email-bp@alien8.de (mailing list archive) |
---|---|
State | Accepted, archived |
Headers | show |
On Sun, Jan 20, 2013 at 3:54 PM, Borislav Petkov <bp@alien8.de> wrote: > From: Borislav Petkov <bp@suse.de> > > Add a helper function to return cpufreq_driver->name. > > Signed-off-by: Borislav Petkov <bp@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.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 --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 */