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

Signed-off-by: Pearson, Greg <greg.pear...@hpe.com>
Signed-off-by: Zhang, Lin-Bao <linbao.zh...@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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to