Patch "cpufreq: use correct unit when verify cur freq" has been added to the 6.2-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    cpufreq: use correct unit when verify cur freq

to the 6.2-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     cpufreq-use-correct-unit-when-verify-cur-freq.patch
and it can be found in the queue-6.2 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit c88dbe4d62da427da90ee1ecc033224e6d60b55e
Author: Sanjay Chandrashekara <sanjayc@xxxxxxxxxx>
Date:   Tue Apr 18 17:04:54 2023 +0530

    cpufreq: use correct unit when verify cur freq
    
    [ Upstream commit 44295af5019f1997d038ad2611086a2d1e2af167 ]
    
    cpufreq_verify_current_freq checks() if the frequency returned by
    the hardware has a slight delta with the valid frequency value
    last set and returns "policy->cur" if the delta is within "1 MHz".
    In the comparison, "policy->cur" is in "kHz" but it's compared
    against HZ_PER_MHZ. So, the comparison range becomes "1 GHz".
    
    Fix this by comparing against KHZ_PER_MHZ instead of HZ_PER_MHZ.
    
    Fixes: f55ae08c8987 ("cpufreq: Avoid unnecessary frequency updates due to mismatch")
    Signed-off-by: Sanjay Chandrashekara <sanjayc@xxxxxxxxxx>
    [ sumit gupta: Commit message update ]
    Signed-off-by: Sumit Gupta <sumitg@xxxxxxxxxx>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 7e56a42750ea5..285ba51b31f60 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1727,7 +1727,7 @@ static unsigned int cpufreq_verify_current_freq(struct cpufreq_policy *policy, b
 		 * MHz. In such cases it is better to avoid getting into
 		 * unnecessary frequency updates.
 		 */
-		if (abs(policy->cur - new_freq) < HZ_PER_MHZ)
+		if (abs(policy->cur - new_freq) < KHZ_PER_MHZ)
 			return policy->cur;
 
 		cpufreq_out_of_sync(policy, new_freq);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux