Commit 895c517f authored by Pavel Machek's avatar Pavel Machek Committed by Linus Torvalds

[PATCH] swsusp: fix process start times after resume

Currently, process start times change after swsusp (because they are
derived from jiffies and current time, oops).  This should fix it.
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent b9e71c24
...@@ -319,7 +319,7 @@ unsigned long get_cmos_time(void) ...@@ -319,7 +319,7 @@ unsigned long get_cmos_time(void)
return retval; return retval;
} }
static long clock_cmos_diff; static long clock_cmos_diff, sleep_start;
static int time_suspend(struct sys_device *dev, u32 state) static int time_suspend(struct sys_device *dev, u32 state)
{ {
...@@ -328,6 +328,7 @@ static int time_suspend(struct sys_device *dev, u32 state) ...@@ -328,6 +328,7 @@ static int time_suspend(struct sys_device *dev, u32 state)
*/ */
clock_cmos_diff = -get_cmos_time(); clock_cmos_diff = -get_cmos_time();
clock_cmos_diff += get_seconds(); clock_cmos_diff += get_seconds();
sleep_start = get_cmos_time();
return 0; return 0;
} }
...@@ -335,10 +336,13 @@ static int time_resume(struct sys_device *dev) ...@@ -335,10 +336,13 @@ static int time_resume(struct sys_device *dev)
{ {
unsigned long flags; unsigned long flags;
unsigned long sec = get_cmos_time() + clock_cmos_diff; unsigned long sec = get_cmos_time() + clock_cmos_diff;
unsigned long sleep_length = get_cmos_time() - sleep_start;
write_seqlock_irqsave(&xtime_lock, flags); write_seqlock_irqsave(&xtime_lock, flags);
xtime.tv_sec = sec; xtime.tv_sec = sec;
xtime.tv_nsec = 0; xtime.tv_nsec = 0;
write_sequnlock_irqrestore(&xtime_lock, flags); write_sequnlock_irqrestore(&xtime_lock, flags);
jiffies += sleep_length * HZ;
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment