diff options
author | Viresh Kumar <viresh.kumar@linaro.org> | 2013-05-20 00:27:17 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-05-22 06:43:33 -0400 |
commit | 9076eaca60b3796b3b97d1914c4924c4bc39f066 (patch) | |
tree | ab78af2dc3dd37150b7d98c42ac9f50250070551 /drivers/cpufreq | |
parent | 92a9b5c291c72aa9899021699458f0b6e328b940 (diff) |
cpufreq: arm_big_little_dt: 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 both arm_big_little_dt
and cpufreq-cpu0 drivers are compiled in, arm_big_little_dt driver may try to
register even if we had platform device for cpufreq-cpu0 registered.
To eliminate this undesired the effect, the patch changes arm_big_little_dt
driver to have it instantiated as a platform_driver. Then it will only run on
platforms that create the platform_device "arm-bL-cpufreq-dt".
Reported-and-tested-by: Rob Herring <robherring2@gmail.com>
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/arm_big_little_dt.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/drivers/cpufreq/arm_big_little_dt.c b/drivers/cpufreq/arm_big_little_dt.c index 27e2f45ccdd5..fd9e3ea6a480 100644 --- a/drivers/cpufreq/arm_big_little_dt.c +++ b/drivers/cpufreq/arm_big_little_dt.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/module.h> | 26 | #include <linux/module.h> |
27 | #include <linux/of.h> | 27 | #include <linux/of.h> |
28 | #include <linux/opp.h> | 28 | #include <linux/opp.h> |
29 | #include <linux/platform_device.h> | ||
29 | #include <linux/slab.h> | 30 | #include <linux/slab.h> |
30 | #include <linux/types.h> | 31 | #include <linux/types.h> |
31 | #include "arm_big_little.h" | 32 | #include "arm_big_little.h" |
@@ -95,7 +96,7 @@ static struct cpufreq_arm_bL_ops dt_bL_ops = { | |||
95 | .init_opp_table = dt_init_opp_table, | 96 | .init_opp_table = dt_init_opp_table, |
96 | }; | 97 | }; |
97 | 98 | ||
98 | static int generic_bL_init(void) | 99 | static int generic_bL_probe(struct platform_device *pdev) |
99 | { | 100 | { |
100 | struct device_node *np; | 101 | struct device_node *np; |
101 | 102 | ||
@@ -106,13 +107,22 @@ static int generic_bL_init(void) | |||
106 | of_node_put(np); | 107 | of_node_put(np); |
107 | return bL_cpufreq_register(&dt_bL_ops); | 108 | return bL_cpufreq_register(&dt_bL_ops); |
108 | } | 109 | } |
109 | module_init(generic_bL_init); | ||
110 | 110 | ||
111 | static void generic_bL_exit(void) | 111 | static int generic_bL_remove(struct platform_device *pdev) |
112 | { | 112 | { |
113 | return bL_cpufreq_unregister(&dt_bL_ops); | 113 | bL_cpufreq_unregister(&dt_bL_ops); |
114 | return 0; | ||
114 | } | 115 | } |
115 | module_exit(generic_bL_exit); | 116 | |
117 | static struct platform_driver generic_bL_platdrv = { | ||
118 | .driver = { | ||
119 | .name = "arm-bL-cpufreq-dt", | ||
120 | .owner = THIS_MODULE, | ||
121 | }, | ||
122 | .probe = generic_bL_probe, | ||
123 | .remove = generic_bL_remove, | ||
124 | }; | ||
125 | module_platform_driver(generic_bL_platdrv); | ||
116 | 126 | ||
117 | MODULE_AUTHOR("Viresh Kumar <viresh.kumar@linaro.org>"); | 127 | MODULE_AUTHOR("Viresh Kumar <viresh.kumar@linaro.org>"); |
118 | MODULE_DESCRIPTION("Generic ARM big LITTLE cpufreq driver via DT"); | 128 | MODULE_DESCRIPTION("Generic ARM big LITTLE cpufreq driver via DT"); |