diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/cpufreq/cpufreq.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 3d0430741b5a..12e63642aa0f 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -346,6 +346,8 @@ show_one(scaling_min_freq, min); | |||
346 | show_one(scaling_max_freq, max); | 346 | show_one(scaling_max_freq, max); |
347 | show_one(scaling_cur_freq, cur); | 347 | show_one(scaling_cur_freq, cur); |
348 | 348 | ||
349 | static int __cpufreq_set_policy(struct cpufreq_policy *data, struct cpufreq_policy *policy); | ||
350 | |||
349 | /** | 351 | /** |
350 | * cpufreq_per_cpu_attr_write() / store_##file_name() - sysfs write access | 352 | * cpufreq_per_cpu_attr_write() / store_##file_name() - sysfs write access |
351 | */ | 353 | */ |
@@ -364,7 +366,10 @@ static ssize_t store_##file_name \ | |||
364 | if (ret != 1) \ | 366 | if (ret != 1) \ |
365 | return -EINVAL; \ | 367 | return -EINVAL; \ |
366 | \ | 368 | \ |
367 | ret = cpufreq_set_policy(&new_policy); \ | 369 | mutex_lock(&policy->lock); \ |
370 | ret = __cpufreq_set_policy(policy, &new_policy); \ | ||
371 | policy->user_policy.object = policy->object; \ | ||
372 | mutex_unlock(&policy->lock); \ | ||
368 | \ | 373 | \ |
369 | return ret ? ret : count; \ | 374 | return ret ? ret : count; \ |
370 | } | 375 | } |
@@ -420,7 +425,15 @@ static ssize_t store_scaling_governor (struct cpufreq_policy * policy, | |||
420 | if (cpufreq_parse_governor(str_governor, &new_policy.policy, &new_policy.governor)) | 425 | if (cpufreq_parse_governor(str_governor, &new_policy.policy, &new_policy.governor)) |
421 | return -EINVAL; | 426 | return -EINVAL; |
422 | 427 | ||
423 | ret = cpufreq_set_policy(&new_policy); | 428 | /* Do not use cpufreq_set_policy here or the user_policy.max |
429 | will be wrongly overridden */ | ||
430 | mutex_lock(&policy->lock); | ||
431 | ret = __cpufreq_set_policy(policy, &new_policy); | ||
432 | |||
433 | policy->user_policy.policy = policy->policy; | ||
434 | policy->user_policy.governor = policy->governor; | ||
435 | mutex_unlock(&policy->lock); | ||
436 | |||
424 | return ret ? ret : count; | 437 | return ret ? ret : count; |
425 | } | 438 | } |
426 | 439 | ||