lkml.org 
[lkml]   [2004]   [Nov]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH 1/3] Fix sysdev time support
From
Date
Make time_suspend and time_resume call get_cmos_time once only, so as to
eliminate unnecessary 1 second delays in suspending and resuming.

diff -ruN 990-old/arch/i386/kernel/time.c 990-new/arch/i386/kernel/time.c
--- 990-old/arch/i386/kernel/time.c 2004-11-12 08:12:58.275103280 +1100
+++ 990-new/arch/i386/kernel/time.c 2004-11-12 07:16:41.000000000 +1100
@@ -323,20 +323,22 @@

static int time_suspend(struct sys_device *dev, u32 state)
{
+ long cmos_time = get_cmos_time();
/*
* Estimate time zone so that set_time can update the clock
*/
- clock_cmos_diff = -get_cmos_time();
+ clock_cmos_diff = -cmos_time;
clock_cmos_diff += get_seconds();
- sleep_start = get_cmos_time();
+ sleep_start = cmos_time;
return 0;
}

static int time_resume(struct sys_device *dev)
{
unsigned long flags;
- unsigned long sec = get_cmos_time() + clock_cmos_diff;
- unsigned long sleep_length = get_cmos_time() - sleep_start;
+ unsigned long cmos_time = get_cmos_time();
+ unsigned long sec = cmos_time + clock_cmos_diff;
+ unsigned long sleep_length = cmos_time - sleep_start;

write_seqlock_irqsave(&xtime_lock, flags);
xtime.tv_sec = sec;
--
Nigel Cunningham
Pastoral Worker
Christian Reformed Church of Tuggeranong
PO Box 1004, Tuggeranong, ACT 2901

You see, at just the right time, when we were still powerless, Christ
died for the ungodly. -- Romans 5:6

-
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/

\
 
 \ /
  Last update: 2005-03-22 14:07    [from the cache]
©2003-2011 Jasper Spaans