--- zzzz-none-000/linux-2.6.32.61/kernel/time/clocksource.c 2013-06-10 09:43:48.000000000 +0000 +++ ar9-7330-650/linux-2.6.32.61/kernel/time/clocksource.c 2011-05-25 13:51:48.000000000 +0000 @@ -131,6 +131,7 @@ static struct timer_list watchdog_timer; static DECLARE_WORK(watchdog_work, clocksource_watchdog_work); static DEFINE_SPINLOCK(watchdog_lock); +static cycle_t watchdog_last; static int watchdog_running; static int clocksource_watchdog_kthread(void *data); @@ -199,6 +200,11 @@ if (!watchdog_running) goto out; + wdnow = watchdog->read(watchdog); + wd_nsec = clocksource_cyc2ns((wdnow - watchdog_last) & watchdog->mask, + watchdog->mult, watchdog->shift); + watchdog_last = wdnow; + list_for_each_entry(cs, &watchdog_list, wd_list) { /* Clocksource already marked unstable? */ @@ -208,28 +214,19 @@ continue; } - local_irq_disable(); csnow = cs->read(cs); - wdnow = watchdog->read(watchdog); - local_irq_enable(); /* Clocksource initialized ? */ if (!(cs->flags & CLOCK_SOURCE_WATCHDOG)) { cs->flags |= CLOCK_SOURCE_WATCHDOG; - cs->wd_last = wdnow; - cs->cs_last = csnow; + cs->wd_last = csnow; continue; } - wd_nsec = clocksource_cyc2ns((wdnow - cs->wd_last) & watchdog->mask, - watchdog->mult, watchdog->shift); - - cs_nsec = clocksource_cyc2ns((csnow - cs->cs_last) & - cs->mask, cs->mult, cs->shift); - cs->cs_last = csnow; - cs->wd_last = wdnow; - /* Check the deviation from the watchdog clocksource. */ + cs_nsec = clocksource_cyc2ns((csnow - cs->wd_last) & + cs->mask, cs->mult, cs->shift); + cs->wd_last = csnow; if (abs(cs_nsec - wd_nsec) > WATCHDOG_THRESHOLD) { clocksource_unstable(cs, cs_nsec - wd_nsec); continue; @@ -267,6 +264,7 @@ return; init_timer(&watchdog_timer); watchdog_timer.function = clocksource_watchdog; + watchdog_last = watchdog->read(watchdog); watchdog_timer.expires = jiffies + WATCHDOG_INTERVAL; add_timer_on(&watchdog_timer, cpumask_first(cpu_online_mask)); watchdog_running = 1; @@ -496,7 +494,7 @@ break; } if (curr_clocksource != best) { - printk(KERN_INFO "Switching to clocksource %s\n", best->name); + /*--- printk(KERN_INFO "Switching to clocksource %s\n", best->name); ---*/ curr_clocksource = best; timekeeping_notify(curr_clocksource); } @@ -632,7 +630,7 @@ * Takes input from sysfs interface for manually overriding the default * clocksource selction. */ -static ssize_t sysfs_override_clocksource(struct sys_device *dev, +ssize_t sysfs_override_clocksource(struct sys_device *dev, struct sysdev_attribute *attr, const char *buf, size_t count) {