diff options
author | Dave Jones <davej@redhat.com> | 2009-08-04 14:03:25 -0400 |
---|---|---|
committer | Dave Jones <davej@redhat.com> | 2009-08-04 14:32:11 -0400 |
commit | 4bc5d34135039566b8d6efa2de7515b2be505da8 (patch) | |
tree | 9405817331384c08569d87aee44c1a4160bad9d0 | |
parent | d5194decd0a6f792b2789eebd4ddf022a248f655 (diff) |
[CPUFREQ] Make cpufreq suspend code conditional on powerpc.
The suspend code runs with interrupts disabled, and the powerpc workaround we
do in the cpufreq suspend hook calls the drivers ->get method.
powernow-k8's ->get does an smp_call_function_single
which needs interrupts enabled
cpufreq's suspend/resume code was added in 42d4dc3f4e1e to work around
a hardware problem on ppc powerbooks. If we make all this code
conditional on powerpc, we avoid the issue above.
Signed-off-by: Dave Jones <davej@redhat.com>
-rw-r--r-- | drivers/cpufreq/cpufreq.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index bd74a0b12176..fd69086d08d5 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -1248,13 +1248,22 @@ EXPORT_SYMBOL(cpufreq_get); | |||
1248 | 1248 | ||
1249 | static int cpufreq_suspend(struct sys_device *sysdev, pm_message_t pmsg) | 1249 | static int cpufreq_suspend(struct sys_device *sysdev, pm_message_t pmsg) |
1250 | { | 1250 | { |
1251 | int cpu = sysdev->id; | ||
1252 | int ret = 0; | 1251 | int ret = 0; |
1252 | |||
1253 | #ifdef __powerpc__ | ||
1254 | int cpu = sysdev->id; | ||
1253 | unsigned int cur_freq = 0; | 1255 | unsigned int cur_freq = 0; |
1254 | struct cpufreq_policy *cpu_policy; | 1256 | struct cpufreq_policy *cpu_policy; |
1255 | 1257 | ||
1256 | dprintk("suspending cpu %u\n", cpu); | 1258 | dprintk("suspending cpu %u\n", cpu); |
1257 | 1259 | ||
1260 | /* | ||
1261 | * This whole bogosity is here because Powerbooks are made of fail. | ||
1262 | * No sane platform should need any of the code below to be run. | ||
1263 | * (it's entirely the wrong thing to do, as driver->get may | ||
1264 | * reenable interrupts on some architectures). | ||
1265 | */ | ||
1266 | |||
1258 | if (!cpu_online(cpu)) | 1267 | if (!cpu_online(cpu)) |
1259 | return 0; | 1268 | return 0; |
1260 | 1269 | ||
@@ -1313,6 +1322,7 @@ static int cpufreq_suspend(struct sys_device *sysdev, pm_message_t pmsg) | |||
1313 | 1322 | ||
1314 | out: | 1323 | out: |
1315 | cpufreq_cpu_put(cpu_policy); | 1324 | cpufreq_cpu_put(cpu_policy); |
1325 | #endif /* __powerpc__ */ | ||
1316 | return ret; | 1326 | return ret; |
1317 | } | 1327 | } |
1318 | 1328 | ||
@@ -1326,12 +1336,18 @@ out: | |||
1326 | */ | 1336 | */ |
1327 | static int cpufreq_resume(struct sys_device *sysdev) | 1337 | static int cpufreq_resume(struct sys_device *sysdev) |
1328 | { | 1338 | { |
1329 | int cpu = sysdev->id; | ||
1330 | int ret = 0; | 1339 | int ret = 0; |
1340 | |||
1341 | #ifdef __powerpc__ | ||
1342 | int cpu = sysdev->id; | ||
1331 | struct cpufreq_policy *cpu_policy; | 1343 | struct cpufreq_policy *cpu_policy; |
1332 | 1344 | ||
1333 | dprintk("resuming cpu %u\n", cpu); | 1345 | dprintk("resuming cpu %u\n", cpu); |
1334 | 1346 | ||
1347 | /* As with the ->suspend method, all the code below is | ||
1348 | * only necessary because Powerbooks suck. | ||
1349 | * See commit 42d4dc3f4e1e for jokes. */ | ||
1350 | |||
1335 | if (!cpu_online(cpu)) | 1351 | if (!cpu_online(cpu)) |
1336 | return 0; | 1352 | return 0; |
1337 | 1353 | ||
@@ -1395,6 +1411,7 @@ out: | |||
1395 | schedule_work(&cpu_policy->update); | 1411 | schedule_work(&cpu_policy->update); |
1396 | fail: | 1412 | fail: |
1397 | cpufreq_cpu_put(cpu_policy); | 1413 | cpufreq_cpu_put(cpu_policy); |
1414 | #endif /* __powerpc__ */ | ||
1398 | return ret; | 1415 | return ret; |
1399 | } | 1416 | } |
1400 | 1417 | ||