aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2014-03-10 06:13:18 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-03-11 20:06:01 -0400
commit2449d33a40553504867f407dd713e9bcf6f9fe24 (patch)
tree86b3ce294a01a4a1c12dddb24d0ae5cd81a9c0a5 /drivers/cpufreq
parent96bbbe4a2a5b13c440a19dd7a5ff33de3303aac4 (diff)
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 <joshc@codeaurora.org> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r--drivers/cpufreq/spear-cpufreq.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/cpufreq/spear-cpufreq.c b/drivers/cpufreq/spear-cpufreq.c
index 410b54a9346c..4cfdcff8a310 100644
--- a/drivers/cpufreq/spear-cpufreq.c
+++ b/drivers/cpufreq/spear-cpufreq.c
@@ -19,6 +19,7 @@
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/module.h> 20#include <linux/module.h>
21#include <linux/of_device.h> 21#include <linux/of_device.h>
22#include <linux/platform_device.h>
22#include <linux/slab.h> 23#include <linux/slab.h>
23#include <linux/types.h> 24#include <linux/types.h>
24 25
@@ -166,7 +167,7 @@ static struct cpufreq_driver spear_cpufreq_driver = {
166 .attr = cpufreq_generic_attr, 167 .attr = cpufreq_generic_attr,
167}; 168};
168 169
169static int spear_cpufreq_driver_init(void) 170static int spear_cpufreq_probe(struct platform_device *pdev)
170{ 171{
171 struct device_node *np; 172 struct device_node *np;
172 const struct property *prop; 173 const struct property *prop;
@@ -234,7 +235,15 @@ out_put_node:
234 of_node_put(np); 235 of_node_put(np);
235 return ret; 236 return ret;
236} 237}
237late_initcall(spear_cpufreq_driver_init); 238
239static struct platform_driver spear_cpufreq_platdrv = {
240 .driver = {
241 .name = "spear-cpufreq",
242 .owner = THIS_MODULE,
243 },
244 .probe = spear_cpufreq_probe,
245};
246module_platform_driver(spear_cpufreq_platdrv);
238 247
239MODULE_AUTHOR("Deepak Sikri <deepak.sikri@st.com>"); 248MODULE_AUTHOR("Deepak Sikri <deepak.sikri@st.com>");
240MODULE_DESCRIPTION("SPEAr CPUFreq driver"); 249MODULE_DESCRIPTION("SPEAr CPUFreq driver");