Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 32642
b: refs/heads/master
c: 3e14347
h: refs/heads/master
v: v3
  • Loading branch information
john stultz authored and Linus Torvalds committed Jul 15, 2006
1 parent 3bf40ad commit 7d9cfd4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 635adb6cd25c8f816c9017a0a0349cd389eafcd3
refs/heads/master: 3e143475c22036847f898d7e76ba337c1d7dbf6f
19 changes: 18 additions & 1 deletion trunk/kernel/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -969,6 +969,7 @@ void __init timekeeping_init(void)
}


static int timekeeping_suspended;
/*
* timekeeping_resume - Resumes the generic timekeeping subsystem.
* @dev: unused
Expand All @@ -984,13 +985,26 @@ static int timekeeping_resume(struct sys_device *dev)
write_seqlock_irqsave(&xtime_lock, flags);
/* restart the last cycle value */
clock->cycle_last = clocksource_read(clock);
clock->error = 0;
timekeeping_suspended = 0;
write_sequnlock_irqrestore(&xtime_lock, flags);
return 0;
}

static int timekeeping_suspend(struct sys_device *dev, pm_message_t state)
{
unsigned long flags;

write_seqlock_irqsave(&xtime_lock, flags);
timekeeping_suspended = 1;
write_sequnlock_irqrestore(&xtime_lock, flags);
return 0;
}

/* sysfs resume/suspend bits for timekeeping */
static struct sysdev_class timekeeping_sysclass = {
.resume = timekeeping_resume,
.suspend = timekeeping_suspend,
set_kset_name("timekeeping"),
};

Expand Down Expand Up @@ -1101,13 +1115,16 @@ static void update_wall_time(void)
{
cycle_t offset;

clock->xtime_nsec += (s64)xtime.tv_nsec << clock->shift;
/* Make sure we're fully resumed: */
if (unlikely(timekeeping_suspended))
return;

#ifdef CONFIG_GENERIC_TIME
offset = (clocksource_read(clock) - clock->cycle_last) & clock->mask;
#else
offset = clock->cycle_interval;
#endif
clock->xtime_nsec += (s64)xtime.tv_nsec << clock->shift;

/* normally this loop will run just once, however in the
* case of lost or late ticks, it will accumulate correctly.
Expand Down

0 comments on commit 7d9cfd4

Please sign in to comment.