Commit 43e940442cc6fb1228eddb2898012135638df1bc

Authored by Nishanth Menon
Committed by Afzal Mohammed
1 parent 1326fa4b31
Exists in master

cpufreq: OMAP: deny initialization if no mpudev

if we do not have mpu_dev we normally fail in cpu_init. It is better
to fail driver registration if the devices are not available.

Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Kevin Hilman <khilman@ti.com>
[vaibhav.bedia@ti.com: Pull in for AM33xx]
Signed-off-by: Vaibhav Bedia <vaibhav.bedia@ti.com>
[afzal@ti.com: use 'omap_device_get_by_hwmod_name' for 'mpu_dev']
Signed-off-by: Afzal Mohammed <afzal@ti.com>

Showing 1 changed file with 9 additions and 7 deletions Side-by-side Diff

drivers/cpufreq/omap-cpufreq.c
... ... @@ -31,6 +31,7 @@
31 31  
32 32 #include <plat/clock.h>
33 33 #include <plat/omap-pm.h>
  34 +#include <plat/omap_device.h>
34 35 #include <plat/common.h>
35 36  
36 37 #include <mach/hardware.h>
... ... @@ -50,6 +51,7 @@
50 51 static struct cpufreq_frequency_table *freq_table;
51 52 static struct clk *mpu_clk;
52 53 static char *mpu_clk_name;
  54 +static struct device *mpu_dev;
53 55  
54 56 static int omap_verify_speed(struct cpufreq_policy *policy)
55 57 {
... ... @@ -152,7 +154,6 @@
152 154 static int __cpuinit omap_cpu_init(struct cpufreq_policy *policy)
153 155 {
154 156 int result = 0;
155   - struct device *mpu_dev;
156 157  
157 158 mpu_clk = clk_get(NULL, mpu_clk_name);
158 159 if (IS_ERR(mpu_clk))
... ... @@ -162,12 +163,6 @@
162 163 return -EINVAL;
163 164  
164 165 policy->cur = policy->min = policy->max = omap_getspeed(policy->cpu);
165   - mpu_dev = omap2_get_mpuss_device();
166   -
167   - if (!mpu_dev) {
168   - pr_warning("%s: unable to get the mpu device\n", __func__);
169   - return -EINVAL;
170   - }
171 166 opp_init_cpufreq_table(mpu_dev, &freq_table);
172 167  
173 168 if (freq_table) {
... ... @@ -239,6 +234,13 @@
239 234 pr_err("%s: unsupported Silicon?\n", __func__);
240 235 return -EINVAL;
241 236 }
  237 +
  238 + mpu_dev = omap_device_get_by_hwmod_name("mpu");
  239 + if (!mpu_dev) {
  240 + pr_warning("%s: unable to get the mpu device\n", __func__);
  241 + return -EINVAL;
  242 + }
  243 +
242 244 return cpufreq_register_driver(&omap_driver);
243 245 }
244 246