From 2449d33a40553504867f407dd713e9bcf6f9fe24 Mon Sep 17 00:00:00 2001 From: Viresh Kumar Date: Mon, 10 Mar 2014 15:43:18 +0530 Subject: cpufreq: SPEAr: Instantiate as platform_driver As multiplatform build is being adopted by more and more ARM platforms, initcall function should be used very carefully. For example, when SPEAr cpufreq driver is enabled on a kernel booted on a non-SPEAr board, we will get following boot time error: spear_cpufreq: Invalid cpufreq_tbl To eliminate this undesired the effect, the patch changes SPEAr driver to have it instantiated as a platform_driver. Then it will only run on platforms that create the platform_device "spear-cpufreq". This patch also creates platform node for SPEAr13xx boards. Reported-by: Josh Cartwright Signed-off-by: Viresh Kumar Signed-off-by: Rafael J. Wysocki --- drivers/cpufreq/spear-cpufreq.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'drivers/cpufreq/spear-cpufreq.c') diff --git a/drivers/cpufreq/spear-cpufreq.c b/drivers/cpufreq/spear-cpufreq.c index 410b54a..4cfdcff 100644 --- a/drivers/cpufreq/spear-cpufreq.c +++ b/drivers/cpufreq/spear-cpufreq.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -166,7 +167,7 @@ static struct cpufreq_driver spear_cpufreq_driver = { .attr = cpufreq_generic_attr, }; -static int spear_cpufreq_driver_init(void) +static int spear_cpufreq_probe(struct platform_device *pdev) { struct device_node *np; const struct property *prop; @@ -234,7 +235,15 @@ out_put_node: of_node_put(np); return ret; } -late_initcall(spear_cpufreq_driver_init); + +static struct platform_driver spear_cpufreq_platdrv = { + .driver = { + .name = "spear-cpufreq", + .owner = THIS_MODULE, + }, + .probe = spear_cpufreq_probe, +}; +module_platform_driver(spear_cpufreq_platdrv); MODULE_AUTHOR("Deepak Sikri "); MODULE_DESCRIPTION("SPEAr CPUFreq driver"); -- cgit v1.1