]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ACPI / PAD: Use time_before() for time comparison
authorManuel Schölling <manuel.schoelling@gmx.de>
Thu, 22 May 2014 20:56:36 +0000 (22:56 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 26 May 2014 23:38:23 +0000 (01:38 +0200)
To be future-proof and for better readability the time comparisons are
modified to use time_before() instead of plain, error-prone math.

Signed-off-by: Manuel Schölling <manuel.schoelling@gmx.de>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/acpi_pad.c

index e20708f2b8e56a89924adf0c5fa8517ccadb4d5d..f148a0580e0404b64b9fe1a104e05c0c1aaa498b 100644 (file)
@@ -156,12 +156,13 @@ static int power_saving_thread(void *data)
 
        while (!kthread_should_stop()) {
                int cpu;
-               u64 expire_time;
+               unsigned long expire_time;
 
                try_to_freeze();
 
                /* round robin to cpus */
-               if (last_jiffies + round_robin_time * HZ < jiffies) {
+               expire_time = last_jiffies + round_robin_time * HZ;
+               if (time_before(expire_time, jiffies)) {
                        last_jiffies = jiffies;
                        round_robin_cpu(tsk_index);
                }
@@ -200,7 +201,7 @@ static int power_saving_thread(void *data)
                                        CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &cpu);
                        local_irq_enable();
 
-                       if (jiffies > expire_time) {
+                       if (time_before(expire_time, jiffies)) {
                                do_sleep = 1;
                                break;
                        }