summaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq
diff options
context:
space:
mode:
authorYue Hu <huyue2@yulong.com>2019-04-19 14:27:58 +0800
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2019-04-23 10:58:43 +0200
commit4db7c34cb41a3d7ed7db7a84413d7c225278c36a (patch)
tree66506ba7044078b2246d76ade741c63b0041cdb5 /drivers/cpufreq
parentb23aa311fa1f376640069e5da897b4a6148d104f (diff)
downloadlinux-4db7c34cb41a3d7ed7db7a84413d7c225278c36a.tar.bz2
cpufreq: Move ->get callback check outside of __cpufreq_get()
Currenly, __cpufreq_get() called by show_cpuinfo_cur_freq() will check ->get callback. That is needless since cpuinfo_cur_freq attribute will not be created if ->get is not set. So let's drop it in __cpufreq_get(). Also keep this check in cpufreq_get(). Signed-off-by: Yue Hu <huyue2@yulong.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r--drivers/cpufreq/cpufreq.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index df7d112fe621..92604afdeec4 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1585,7 +1585,7 @@ static unsigned int __cpufreq_get(struct cpufreq_policy *policy)
{
unsigned int ret_freq = 0;
- if (unlikely(policy_is_inactive(policy)) || !cpufreq_driver->get)
+ if (unlikely(policy_is_inactive(policy)))
return ret_freq;
ret_freq = cpufreq_driver->get(policy->cpu);
@@ -1623,7 +1623,8 @@ unsigned int cpufreq_get(unsigned int cpu)
if (policy) {
down_read(&policy->rwsem);
- ret_freq = __cpufreq_get(policy);
+ if (cpufreq_driver->get)
+ ret_freq = __cpufreq_get(policy);
up_read(&policy->rwsem);
cpufreq_cpu_put(policy);