]> err.no Git - linux-2.6/blobdiff - kernel/time/clocksource.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394...
[linux-2.6] / kernel / time / clocksource.c
index 6e9259a5d5010ac7e869f4f567fd3c0618002943..73961f35fdc84ba1ba28251bb4115f52b094d908 100644 (file)
@@ -91,7 +91,6 @@ static void clocksource_ratewd(struct clocksource *cs, int64_t delta)
               cs->name, delta);
        cs->flags &= ~(CLOCK_SOURCE_VALID_FOR_HRES | CLOCK_SOURCE_WATCHDOG);
        clocksource_change_rating(cs, 0);
-       cs->flags &= ~CLOCK_SOURCE_WATCHDOG;
        list_del(&cs->wd_list);
 }
 
@@ -142,9 +141,12 @@ static void clocksource_watchdog(unsigned long data)
        }
 
        if (!list_empty(&watchdog_list)) {
-               /* Cycle through CPUs to check if the CPUs stay synchronized to
-                * each other. */
+               /*
+                * Cycle through CPUs to check if the CPUs stay
+                * synchronized to each other.
+                */
                int next_cpu = next_cpu(raw_smp_processor_id(), cpu_online_map);
+
                if (next_cpu >= NR_CPUS)
                        next_cpu = first_cpu(cpu_online_map);
                watchdog_timer.expires += WATCHDOG_INTERVAL;
@@ -170,7 +172,8 @@ static void clocksource_check_watchdog(struct clocksource *cs)
                if (!started && watchdog) {
                        watchdog_last = watchdog->read();
                        watchdog_timer.expires = jiffies + WATCHDOG_INTERVAL;
-                       add_timer_on(&watchdog_timer, first_cpu(cpu_online_map));
+                       add_timer_on(&watchdog_timer,
+                                    first_cpu(cpu_online_map));
                }
        } else {
                if (cs->flags & CLOCK_SOURCE_IS_CONTINUOUS)
@@ -180,7 +183,7 @@ static void clocksource_check_watchdog(struct clocksource *cs)
                        if (watchdog)
                                del_timer(&watchdog_timer);
                        watchdog = cs;
-                       init_timer_deferrable(&watchdog_timer);
+                       init_timer(&watchdog_timer);
                        watchdog_timer.function = clocksource_watchdog;
 
                        /* Reset watchdog cycles */
@@ -192,7 +195,7 @@ static void clocksource_check_watchdog(struct clocksource *cs)
                                watchdog_timer.expires =
                                        jiffies + WATCHDOG_INTERVAL;
                                add_timer_on(&watchdog_timer,
-                                               first_cpu(cpu_online_map));
+                                            first_cpu(cpu_online_map));
                        }
                }
        }
@@ -228,6 +231,18 @@ void clocksource_resume(void)
        spin_unlock_irqrestore(&clocksource_lock, flags);
 }
 
+/**
+ * clocksource_touch_watchdog - Update watchdog
+ *
+ * Update the watchdog after exception contexts such as kgdb so as not
+ * to incorrectly trip the watchdog.
+ *
+ */
+void clocksource_touch_watchdog(void)
+{
+       clocksource_resume_watchdog();
+}
+
 /**
  * clocksource_get_next - Returns the selected clocksource
  *
@@ -363,15 +378,13 @@ void clocksource_unregister(struct clocksource *cs)
 static ssize_t
 sysfs_show_current_clocksources(struct sys_device *dev, char *buf)
 {
-       char *curr = buf;
+       ssize_t count = 0;
 
        spin_lock_irq(&clocksource_lock);
-       curr += sprintf(curr, "%s ", curr_clocksource->name);
+       count = snprintf(buf, PAGE_SIZE, "%s\n", curr_clocksource->name);
        spin_unlock_irq(&clocksource_lock);
 
-       curr += sprintf(curr, "\n");
-
-       return curr - buf;
+       return count;
 }
 
 /**
@@ -439,17 +452,20 @@ static ssize_t
 sysfs_show_available_clocksources(struct sys_device *dev, char *buf)
 {
        struct clocksource *src;
-       char *curr = buf;
+       ssize_t count = 0;
 
        spin_lock_irq(&clocksource_lock);
        list_for_each_entry(src, &clocksource_list, list) {
-               curr += sprintf(curr, "%s ", src->name);
+               count += snprintf(buf + count,
+                                 max((ssize_t)PAGE_SIZE - count, (ssize_t)0),
+                                 "%s ", src->name);
        }
        spin_unlock_irq(&clocksource_lock);
 
-       curr += sprintf(curr, "\n");
+       count += snprintf(buf + count,
+                         max((ssize_t)PAGE_SIZE - count, (ssize_t)0), "\n");
 
-       return curr - buf;
+       return count;
 }
 
 /*