Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 163061
b: refs/heads/master
c: 0f8e8ef
h: refs/heads/master
i:
  163059: c70ae37
v: v3
  • Loading branch information
Martin Schwidefsky authored and Thomas Gleixner committed Aug 15, 2009
1 parent aaa1bb1 commit 8ce4558
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 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: 8cf4e750f8459d51c2e8a035a201da4bf7aa996a
refs/heads/master: 0f8e8ef7c204988246da5a42d576b7fa5277a8e4
23 changes: 15 additions & 8 deletions trunk/kernel/time/clocksource.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ static struct clocksource *watchdog;
static struct timer_list watchdog_timer;
static DEFINE_SPINLOCK(watchdog_lock);
static cycle_t watchdog_last;
static unsigned long watchdog_resumed;

/*
* Interval: 0.5sec Threshold: 0.0625s
Expand All @@ -167,12 +166,9 @@ static void clocksource_watchdog(unsigned long data)
struct clocksource *cs, *tmp;
cycle_t csnow, wdnow;
int64_t wd_nsec, cs_nsec;
int resumed;

spin_lock(&watchdog_lock);

resumed = test_and_clear_bit(0, &watchdog_resumed);

wdnow = watchdog->read(watchdog);
wd_nsec = cyc2ns(watchdog, (wdnow - watchdog_last) & watchdog->mask);
watchdog_last = wdnow;
Expand Down Expand Up @@ -223,14 +219,26 @@ static void clocksource_watchdog(unsigned long data)
}
spin_unlock(&watchdog_lock);
}

static inline void clocksource_reset_watchdog(void)
{
struct clocksource *cs;

list_for_each_entry(cs, &watchdog_list, wd_list)
cs->flags &= ~CLOCK_SOURCE_WATCHDOG;
}

static void clocksource_resume_watchdog(void)
{
set_bit(0, &watchdog_resumed);
unsigned long flags;

spin_lock_irqsave(&watchdog_lock, flags);
clocksource_reset_watchdog();
spin_unlock_irqrestore(&watchdog_lock, flags);
}

static void clocksource_check_watchdog(struct clocksource *cs)
{
struct clocksource *cse;
unsigned long flags;

spin_lock_irqsave(&watchdog_lock, flags);
Expand All @@ -256,8 +264,7 @@ static void clocksource_check_watchdog(struct clocksource *cs)
watchdog_timer.function = clocksource_watchdog;

/* Reset watchdog cycles */
list_for_each_entry(cse, &watchdog_list, wd_list)
cse->flags &= ~CLOCK_SOURCE_WATCHDOG;
clocksource_reset_watchdog();
/* Start if list is not empty */
if (!list_empty(&watchdog_list)) {
watchdog_last = watchdog->read(watchdog);
Expand Down

0 comments on commit 8ce4558

Please sign in to comment.