path: root/drivers/cpufreq/highbank-cpufreq.c
diff options
authorShawn Guo <shawn.guo@linaro.org>2013-01-30 14:27:49 +0000
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-02-02 00:01:16 +0100
commit5553f9e26f6f49a93ba732fd222eac6973a4cf35 (patch)
tree039a24ab646dc51c047f7b6695dcbb73f190a6e0 /drivers/cpufreq/highbank-cpufreq.c
parent58ddcead4f163a01cef96aa5ba88f374011d8aea (diff)
cpufreq: instantiate cpufreq-cpu0 as a platform_driver
As multiplatform build is being adopted by more and more ARM platforms, initcall function should be used very carefully. For example, when GENERIC_CPUFREQ_CPU0 is built in the kernel, cpu0_cpufreq_driver_init() will be called on all the platforms to initialize cpufreq-cpu0 driver. To eliminate this undesired the effect, the patch changes cpufreq-cpu0 driver to have it instantiated as a platform_driver. Then it will only run on platforms that create the platform_device "cpufreq-cpu0". Along with the change, it also changes cpu_dev to be &pdev->dev, so that managed functions can start working, and module build gets supported too. The highbank-cpufreq driver is also updated accordingly to adapt the changes on cpufreq-cpu0. Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Mark Langsdorf <mark.langsdorf@calxeda.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/cpufreq/highbank-cpufreq.c')
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/cpufreq/highbank-cpufreq.c b/drivers/cpufreq/highbank-cpufreq.c
index 53f25e5aa6b7..66e3a71b81a3 100644
--- a/drivers/cpufreq/highbank-cpufreq.c
+++ b/drivers/cpufreq/highbank-cpufreq.c
@@ -20,6 +20,7 @@
#include <linux/err.h>
#include <linux/of.h>
#include <linux/mailbox.h>
+#include <linux/platform_device.h>
#define HB_CPUFREQ_CHANGE_NOTE 0x80000001
@@ -65,6 +66,7 @@ static struct notifier_block hb_cpufreq_clk_nb = {
static int hb_cpufreq_driver_init(void)
+ struct platform_device_info devinfo = { .name = "cpufreq-cpu0", };
struct device *cpu_dev;
struct clk *cpu_clk;
struct device_node *np;
@@ -104,6 +106,9 @@ static int hb_cpufreq_driver_init(void)
goto out_put_node;
+ /* Instantiate cpufreq-cpu0 */
+ platform_device_register_full(&devinfo);
return ret;