aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/time
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/time')
-rw-r--r--kernel/time/clocksource.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index 02dc22d888fe..c6bff11f7957 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -131,6 +131,7 @@ static cycle_t watchdog_last;
131static int watchdog_running; 131static int watchdog_running;
132 132
133static void clocksource_watchdog_work(struct work_struct *work); 133static void clocksource_watchdog_work(struct work_struct *work);
134static void __clocksource_change_rating(struct clocksource *cs, int rating);
134 135
135/* 136/*
136 * Interval: 0.5sec Threshold: 0.0625s 137 * Interval: 0.5sec Threshold: 0.0625s
@@ -309,6 +310,7 @@ static void clocksource_watchdog_work(struct work_struct *work)
309 unsigned long flags; 310 unsigned long flags;
310 LIST_HEAD(unstable); 311 LIST_HEAD(unstable);
311 312
313 mutex_lock(&clocksource_mutex);
312 spin_lock_irqsave(&watchdog_lock, flags); 314 spin_lock_irqsave(&watchdog_lock, flags);
313 list_for_each_entry_safe(cs, tmp, &watchdog_list, wd_list) 315 list_for_each_entry_safe(cs, tmp, &watchdog_list, wd_list)
314 if (cs->flags & CLOCK_SOURCE_UNSTABLE) { 316 if (cs->flags & CLOCK_SOURCE_UNSTABLE) {
@@ -322,8 +324,9 @@ static void clocksource_watchdog_work(struct work_struct *work)
322 /* Needs to be done outside of watchdog lock */ 324 /* Needs to be done outside of watchdog lock */
323 list_for_each_entry_safe(cs, tmp, &unstable, wd_list) { 325 list_for_each_entry_safe(cs, tmp, &unstable, wd_list) {
324 list_del_init(&cs->wd_list); 326 list_del_init(&cs->wd_list);
325 clocksource_change_rating(cs, 0); 327 __clocksource_change_rating(cs, 0);
326 } 328 }
329 mutex_unlock(&clocksource_mutex);
327} 330}
328 331
329#else /* CONFIG_CLOCKSOURCE_WATCHDOG */ 332#else /* CONFIG_CLOCKSOURCE_WATCHDOG */
@@ -470,16 +473,21 @@ int clocksource_register(struct clocksource *cs)
470} 473}
471EXPORT_SYMBOL(clocksource_register); 474EXPORT_SYMBOL(clocksource_register);
472 475
476static void __clocksource_change_rating(struct clocksource *cs, int rating)
477{
478 list_del(&cs->list);
479 cs->rating = rating;
480 clocksource_enqueue(cs);
481 clocksource_select();
482}
483
473/** 484/**
474 * clocksource_change_rating - Change the rating of a registered clocksource 485 * clocksource_change_rating - Change the rating of a registered clocksource
475 */ 486 */
476void clocksource_change_rating(struct clocksource *cs, int rating) 487void clocksource_change_rating(struct clocksource *cs, int rating)
477{ 488{
478 mutex_lock(&clocksource_mutex); 489 mutex_lock(&clocksource_mutex);
479 list_del(&cs->list); 490 __clocksource_change_rating(cs, rating);
480 cs->rating = rating;
481 clocksource_enqueue(cs);
482 clocksource_select();
483 mutex_unlock(&clocksource_mutex); 491 mutex_unlock(&clocksource_mutex);
484} 492}
485EXPORT_SYMBOL(clocksource_change_rating); 493EXPORT_SYMBOL(clocksource_change_rating);