aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq
diff options
context:
space:
mode:
authorDirk Brandewie <dirk.j.brandewie@intel.com>2013-01-17 11:22:21 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-02-01 18:01:14 -0500
commitd5aaffa9dd531c978c6f3fea06a2972653bd7fc8 (patch)
tree4ce3e3de25daaaf25b5fa09f4596314b3b68de4d /drivers/cpufreq
parentb8eed8af94f9203e0cc39245ea335f4b8dc1ed31 (diff)
cpufreq: handle cpufreq being disabled for all exported function.
When disable_cpufreq() is called some exported functions are still being used that do not have a check for cpufreq being disabled. Add a disabled check into cpufreq_cpu_get() to return NULL if cpufreq is disabled this covers most of the exported functions. For the exported functions that do not call cpufreq_cpu_get() add an explicit check. Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r--drivers/cpufreq/cpufreq.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 9af14a8bbcdb..2417576393a6 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -183,6 +183,9 @@ err_out:
183 183
184struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu) 184struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu)
185{ 185{
186 if (cpufreq_disabled())
187 return NULL;
188
186 return __cpufreq_cpu_get(cpu, false); 189 return __cpufreq_cpu_get(cpu, false);
187} 190}
188EXPORT_SYMBOL_GPL(cpufreq_cpu_get); 191EXPORT_SYMBOL_GPL(cpufreq_cpu_get);
@@ -201,6 +204,9 @@ static void __cpufreq_cpu_put(struct cpufreq_policy *data, bool sysfs)
201 204
202void cpufreq_cpu_put(struct cpufreq_policy *data) 205void cpufreq_cpu_put(struct cpufreq_policy *data)
203{ 206{
207 if (cpufreq_disabled())
208 return;
209
204 __cpufreq_cpu_put(data, false); 210 __cpufreq_cpu_put(data, false);
205} 211}
206EXPORT_SYMBOL_GPL(cpufreq_cpu_put); 212EXPORT_SYMBOL_GPL(cpufreq_cpu_put);
@@ -267,6 +273,9 @@ void cpufreq_notify_transition(struct cpufreq_freqs *freqs, unsigned int state)
267 273
268 BUG_ON(irqs_disabled()); 274 BUG_ON(irqs_disabled());
269 275
276 if (cpufreq_disabled())
277 return;
278
270 freqs->flags = cpufreq_driver->flags; 279 freqs->flags = cpufreq_driver->flags;
271 pr_debug("notification %u of frequency transition to %u kHz\n", 280 pr_debug("notification %u of frequency transition to %u kHz\n",
272 state, freqs->new); 281 state, freqs->new);
@@ -1408,6 +1417,9 @@ int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list)
1408{ 1417{
1409 int ret; 1418 int ret;
1410 1419
1420 if (cpufreq_disabled())
1421 return -EINVAL;
1422
1411 WARN_ON(!init_cpufreq_transition_notifier_list_called); 1423 WARN_ON(!init_cpufreq_transition_notifier_list_called);
1412 1424
1413 switch (list) { 1425 switch (list) {
@@ -1442,6 +1454,9 @@ int cpufreq_unregister_notifier(struct notifier_block *nb, unsigned int list)
1442{ 1454{
1443 int ret; 1455 int ret;
1444 1456
1457 if (cpufreq_disabled())
1458 return -EINVAL;
1459
1445 switch (list) { 1460 switch (list) {
1446 case CPUFREQ_TRANSITION_NOTIFIER: 1461 case CPUFREQ_TRANSITION_NOTIFIER:
1447 ret = srcu_notifier_chain_unregister( 1462 ret = srcu_notifier_chain_unregister(
@@ -1522,6 +1537,9 @@ int __cpufreq_driver_getavg(struct cpufreq_policy *policy, unsigned int cpu)
1522{ 1537{
1523 int ret = 0; 1538 int ret = 0;
1524 1539
1540 if (cpufreq_disabled())
1541 return ret;
1542
1525 if (!(cpu_online(cpu) && cpufreq_driver->getavg)) 1543 if (!(cpu_online(cpu) && cpufreq_driver->getavg))
1526 return 0; 1544 return 0;
1527 1545