cpufreq: Add a get_current_driver helper
authorBorislav Petkov <bp@suse.de>
Sun, 20 Jan 2013 10:24:28 +0000 (10:24 +0000)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 1 Feb 2013 23:01:15 +0000 (00:01 +0100)
Add a helper function to return cpufreq_driver->name.

Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpufreq/cpufreq.c
include/linux/cpufreq.h

index 2417576393a68efdee5575c3026823442ca1ce42..216c104d51add116ad66ff9a5d5a425fe5bc8bb1 100644 (file)
@@ -1395,6 +1395,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                      *
index 52be2d0c994a544c41105e22e83d23cc42009823..1f3a726640e814460d0db125148c2d61ba8b0a13 100644 (file)
@@ -411,4 +411,5 @@ void cpufreq_frequency_table_get_attr(struct cpufreq_frequency_table *table,
 void cpufreq_frequency_table_update_policy_cpu(struct cpufreq_policy *policy);
 
 void cpufreq_frequency_table_put_attr(unsigned int cpu);
+const char *cpufreq_get_current_driver(void);
 #endif /* _LINUX_CPUFREQ_H */