diff options
-rw-r--r-- | drivers/rtc/interface.c | 13 | ||||
-rw-r--r-- | kernel/time/clocksource.c | 1 | ||||
-rw-r--r-- | kernel/time/ntp.c | 3 |
3 files changed, 12 insertions, 5 deletions
diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c index 72c5cdbe0791..544be722937c 100644 --- a/drivers/rtc/interface.c +++ b/drivers/rtc/interface.c | |||
@@ -72,6 +72,7 @@ int rtc_set_time(struct rtc_device *rtc, struct rtc_time *tm) | |||
72 | } else | 72 | } else |
73 | err = -EINVAL; | 73 | err = -EINVAL; |
74 | 74 | ||
75 | pm_stay_awake(rtc->dev.parent); | ||
75 | mutex_unlock(&rtc->ops_lock); | 76 | mutex_unlock(&rtc->ops_lock); |
76 | /* A timer might have just expired */ | 77 | /* A timer might have just expired */ |
77 | schedule_work(&rtc->irqwork); | 78 | schedule_work(&rtc->irqwork); |
@@ -113,6 +114,7 @@ int rtc_set_mmss(struct rtc_device *rtc, unsigned long secs) | |||
113 | err = -EINVAL; | 114 | err = -EINVAL; |
114 | } | 115 | } |
115 | 116 | ||
117 | pm_stay_awake(rtc->dev.parent); | ||
116 | mutex_unlock(&rtc->ops_lock); | 118 | mutex_unlock(&rtc->ops_lock); |
117 | /* A timer might have just expired */ | 119 | /* A timer might have just expired */ |
118 | schedule_work(&rtc->irqwork); | 120 | schedule_work(&rtc->irqwork); |
@@ -771,9 +773,10 @@ static int rtc_timer_enqueue(struct rtc_device *rtc, struct rtc_timer *timer) | |||
771 | alarm.time = rtc_ktime_to_tm(timer->node.expires); | 773 | alarm.time = rtc_ktime_to_tm(timer->node.expires); |
772 | alarm.enabled = 1; | 774 | alarm.enabled = 1; |
773 | err = __rtc_set_alarm(rtc, &alarm); | 775 | err = __rtc_set_alarm(rtc, &alarm); |
774 | if (err == -ETIME) | 776 | if (err == -ETIME) { |
777 | pm_stay_awake(rtc->dev.parent); | ||
775 | schedule_work(&rtc->irqwork); | 778 | schedule_work(&rtc->irqwork); |
776 | else if (err) { | 779 | } else if (err) { |
777 | timerqueue_del(&rtc->timerqueue, &timer->node); | 780 | timerqueue_del(&rtc->timerqueue, &timer->node); |
778 | timer->enabled = 0; | 781 | timer->enabled = 0; |
779 | return err; | 782 | return err; |
@@ -818,8 +821,10 @@ static void rtc_timer_remove(struct rtc_device *rtc, struct rtc_timer *timer) | |||
818 | alarm.time = rtc_ktime_to_tm(next->expires); | 821 | alarm.time = rtc_ktime_to_tm(next->expires); |
819 | alarm.enabled = 1; | 822 | alarm.enabled = 1; |
820 | err = __rtc_set_alarm(rtc, &alarm); | 823 | err = __rtc_set_alarm(rtc, &alarm); |
821 | if (err == -ETIME) | 824 | if (err == -ETIME) { |
825 | pm_stay_awake(rtc->dev.parent); | ||
822 | schedule_work(&rtc->irqwork); | 826 | schedule_work(&rtc->irqwork); |
827 | } | ||
823 | } | 828 | } |
824 | } | 829 | } |
825 | 830 | ||
@@ -845,7 +850,6 @@ void rtc_timer_do_work(struct work_struct *work) | |||
845 | 850 | ||
846 | mutex_lock(&rtc->ops_lock); | 851 | mutex_lock(&rtc->ops_lock); |
847 | again: | 852 | again: |
848 | pm_relax(rtc->dev.parent); | ||
849 | __rtc_read_time(rtc, &tm); | 853 | __rtc_read_time(rtc, &tm); |
850 | now = rtc_tm_to_ktime(tm); | 854 | now = rtc_tm_to_ktime(tm); |
851 | while ((next = timerqueue_getnext(&rtc->timerqueue))) { | 855 | while ((next = timerqueue_getnext(&rtc->timerqueue))) { |
@@ -880,6 +884,7 @@ again: | |||
880 | } else | 884 | } else |
881 | rtc_alarm_disable(rtc); | 885 | rtc_alarm_disable(rtc); |
882 | 886 | ||
887 | pm_relax(rtc->dev.parent); | ||
883 | mutex_unlock(&rtc->ops_lock); | 888 | mutex_unlock(&rtc->ops_lock); |
884 | } | 889 | } |
885 | 890 | ||
diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c index 637a14af6c21..64cf63ca09cc 100644 --- a/kernel/time/clocksource.c +++ b/kernel/time/clocksource.c | |||
@@ -479,6 +479,7 @@ static inline void clocksource_dequeue_watchdog(struct clocksource *cs) { } | |||
479 | static inline void clocksource_resume_watchdog(void) { } | 479 | static inline void clocksource_resume_watchdog(void) { } |
480 | static inline int __clocksource_watchdog_kthread(void) { return 0; } | 480 | static inline int __clocksource_watchdog_kthread(void) { return 0; } |
481 | static bool clocksource_is_watchdog(struct clocksource *cs) { return false; } | 481 | static bool clocksource_is_watchdog(struct clocksource *cs) { return false; } |
482 | void clocksource_mark_unstable(struct clocksource *cs) { } | ||
482 | 483 | ||
483 | #endif /* CONFIG_CLOCKSOURCE_WATCHDOG */ | 484 | #endif /* CONFIG_CLOCKSOURCE_WATCHDOG */ |
484 | 485 | ||
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c index 8f5b3b98577b..ab1fa7cb8912 100644 --- a/kernel/time/ntp.c +++ b/kernel/time/ntp.c | |||
@@ -475,6 +475,7 @@ static void sync_cmos_clock(struct work_struct *work) | |||
475 | * called as close as possible to 500 ms before the new second starts. | 475 | * called as close as possible to 500 ms before the new second starts. |
476 | * This code is run on a timer. If the clock is set, that timer | 476 | * This code is run on a timer. If the clock is set, that timer |
477 | * may not expire at the correct time. Thus, we adjust... | 477 | * may not expire at the correct time. Thus, we adjust... |
478 | * We want the clock to be within a couple of ticks from the target. | ||
478 | */ | 479 | */ |
479 | if (!ntp_synced()) { | 480 | if (!ntp_synced()) { |
480 | /* | 481 | /* |
@@ -485,7 +486,7 @@ static void sync_cmos_clock(struct work_struct *work) | |||
485 | } | 486 | } |
486 | 487 | ||
487 | getnstimeofday(&now); | 488 | getnstimeofday(&now); |
488 | if (abs(now.tv_nsec - (NSEC_PER_SEC / 2)) <= tick_nsec / 2) { | 489 | if (abs(now.tv_nsec - (NSEC_PER_SEC / 2)) <= tick_nsec * 5) { |
489 | struct timespec adjust = now; | 490 | struct timespec adjust = now; |
490 | 491 | ||
491 | fail = -ENODEV; | 492 | fail = -ENODEV; |