Messages in this thread Patch in this message | | | Subject | Patch 1/3: Reduce number of get_cmos_time_calls. | From | Nigel Cunningham <> | Date | Sat, 08 Jan 2005 20:42:10 +1100 |
| |
Reduce the number of calls to get_cmos_time. Since get_cmos_time waits for the start of a new second, two consecutive calls add one full second to the time to suspend/resume.
Signed-off-by: Nigel Cunningham <ncunningham@linuxmail.org>
diff -ruNp 911-old/arch/i386/kernel/time.c 911-new/arch/i386/kernel/time.c --- 911-old/arch/i386/kernel/time.c 2005-01-08 19:36:46.107382632 +1100 +++ 911-new/arch/i386/kernel/time.c 2005-01-08 19:36:25.439524624 +1100 @@ -326,9 +326,11 @@ static int timer_suspend(struct sys_devi /* * Estimate time zone so that set_time can update the clock */ - clock_cmos_diff = -get_cmos_time(); + long cmos_time = get_cmos_time(); + + clock_cmos_diff = -cmos_time; clock_cmos_diff += get_seconds(); - sleep_start = get_cmos_time(); + sleep_start = cmos_time; return 0; } @@ -337,13 +339,15 @@ static int timer_resume(struct sys_devic unsigned long flags; unsigned long sec; unsigned long sleep_length; + unsigned long cmos_time; #ifdef CONFIG_HPET_TIMER if (is_hpet_enabled()) hpet_reenable(); #endif - sec = get_cmos_time() + clock_cmos_diff; - sleep_length = (get_cmos_time() - sleep_start) * HZ; + cmos_time = get_cmos_time(); + sec = cmos_time + clock_cmos_diff; + sleep_length = (cmos_time - sleep_start) * HZ; write_seqlock_irqsave(&xtime_lock, flags); xtime.tv_sec = sec; xtime.tv_nsec = 0;
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |