diff options
Diffstat (limited to 'drivers/cpufreq/cpufreq.c')
-rw-r--r-- | drivers/cpufreq/cpufreq.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index cb003a6b72c8..c4cacabbbb55 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -1546,23 +1546,16 @@ static unsigned int __cpufreq_get(unsigned int cpu) | |||
1546 | */ | 1546 | */ |
1547 | unsigned int cpufreq_get(unsigned int cpu) | 1547 | unsigned int cpufreq_get(unsigned int cpu) |
1548 | { | 1548 | { |
1549 | struct cpufreq_policy *policy = per_cpu(cpufreq_cpu_data, cpu); | 1549 | struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); |
1550 | unsigned int ret_freq = 0; | 1550 | unsigned int ret_freq = 0; |
1551 | 1551 | ||
1552 | if (cpufreq_disabled() || !cpufreq_driver) | 1552 | if (policy) { |
1553 | return -ENOENT; | 1553 | down_read(&policy->rwsem); |
1554 | 1554 | ret_freq = __cpufreq_get(cpu); | |
1555 | BUG_ON(!policy); | 1555 | up_read(&policy->rwsem); |
1556 | |||
1557 | if (!down_read_trylock(&cpufreq_rwsem)) | ||
1558 | return 0; | ||
1559 | |||
1560 | down_read(&policy->rwsem); | ||
1561 | |||
1562 | ret_freq = __cpufreq_get(cpu); | ||
1563 | 1556 | ||
1564 | up_read(&policy->rwsem); | 1557 | cpufreq_cpu_put(policy); |
1565 | up_read(&cpufreq_rwsem); | 1558 | } |
1566 | 1559 | ||
1567 | return ret_freq; | 1560 | return ret_freq; |
1568 | } | 1561 | } |