]> Git Repo - linux.git/blobdiff - drivers/cpuidle/poll_state.c
Merge tag 'media/v4.20-3' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab...
[linux.git] / drivers / cpuidle / poll_state.c
index 3f86d23c592ec0cdce4b6e8019a02256f4146d78..85792d371add6558ffd429da2b0b6638c64ac921 100644 (file)
@@ -9,7 +9,6 @@
 #include <linux/sched/clock.h>
 #include <linux/sched/idle.h>
 
-#define POLL_IDLE_TIME_LIMIT   (TICK_NSEC / 16)
 #define POLL_IDLE_RELAX_COUNT  200
 
 static int __cpuidle poll_idle(struct cpuidle_device *dev,
@@ -17,8 +16,11 @@ static int __cpuidle poll_idle(struct cpuidle_device *dev,
 {
        u64 time_start = local_clock();
 
+       dev->poll_time_limit = false;
+
        local_irq_enable();
        if (!current_set_polling_and_test()) {
+               u64 limit = (u64)drv->states[1].target_residency * NSEC_PER_USEC;
                unsigned int loop_count = 0;
 
                while (!need_resched()) {
@@ -27,8 +29,10 @@ static int __cpuidle poll_idle(struct cpuidle_device *dev,
                                continue;
 
                        loop_count = 0;
-                       if (local_clock() - time_start > POLL_IDLE_TIME_LIMIT)
+                       if (local_clock() - time_start > limit) {
+                               dev->poll_time_limit = true;
                                break;
+                       }
                }
        }
        current_clr_polling();
This page took 0.02645 seconds and 4 git commands to generate.