lkml.org 
[lkml]   [2015]   [Nov]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v1 2/2] retry 2 times when getting cpu frequency is zero
Date

when getting cpu frequency failures, it will retry 2 times at most.

Signed-off-by: Pearson, Greg <greg.pearson@hpe.com>
Signed-off-by: Zhang, Lin-Bao <linbao.zhang@hpe.com>
---
drivers/cpufreq/pcc-cpufreq.c | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/drivers/cpufreq/pcc-cpufreq.c b/drivers/cpufreq/pcc-cpufreq.c
index c8f1616..159dede 100644
--- a/drivers/cpufreq/pcc-cpufreq.c
+++ b/drivers/cpufreq/pcc-cpufreq.c
@@ -108,6 +108,7 @@ struct pcc_cpu {
u32 input_offset;
u32 output_offset;
u64 prev_time;
+ u32 get_freq_retry;
};

static u32 max_time_between_cmds = 0;
@@ -225,6 +226,17 @@ static unsigned int pcc_get_freq(unsigned int cpu)

curr_freq = real_pcc_get_freq(cpu);

+ spin_lock(&pcc_lock);
+ if (curr_freq == 0 && pcc_cpu_data->get_freq_retry < 2) {
+ pcc_cpu_data->get_freq_retry++;
+ spin_unlock(&pcc_lock);
+ curr_freq = pcc_get_freq(cpu);
+ return curr_freq;
+ }
+
+ pcc_cpu_data->get_freq_retry = 0;
+ spin_unlock(&pcc_lock);
+
return curr_freq;
}

--
1.8.5.2

\
 
 \ /
  Last update: 2015-11-16 12:01    [W:0.020 / U:4.236 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site