Skip to content
This repository has been archived by the owner on Aug 27, 2022. It is now read-only.

Commit

Permalink
ACPI / PAD: Use time_before() for time comparison
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
manuels authored and rafaeljw committed May 26, 2014
1 parent 5b59c69 commit 4ff248f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions drivers/acpi/acpi_pad.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 4ff248f

Please sign in to comment.