aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/time.c
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2009-11-11 18:59:04 -0500
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2009-11-11 18:59:04 -0500
commit0526484aa345adbf790d1201a6f5d09be0a648a3 (patch)
tree8da37ac2858a960e80dc59ebc4afc460935724f4 /arch/powerpc/kernel/time.c
parente0ea8b2c0677e6cc44a0e5b867be48867f91de5b (diff)
parentaa021baa3295fa6e3f367d80f8955dd5176656eb (diff)
Merge commit 'origin/master' into next
Diffstat (limited to 'arch/powerpc/kernel/time.c')
-rw-r--r--arch/powerpc/kernel/time.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index e05f6af64353..6c9e20898fa7 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -778,7 +778,7 @@ int update_persistent_clock(struct timespec now)
778 return ppc_md.set_rtc_time(&tm); 778 return ppc_md.set_rtc_time(&tm);
779} 779}
780 780
781void read_persistent_clock(struct timespec *ts) 781static void __read_persistent_clock(struct timespec *ts)
782{ 782{
783 struct rtc_time tm; 783 struct rtc_time tm;
784 static int first = 1; 784 static int first = 1;
@@ -801,10 +801,23 @@ void read_persistent_clock(struct timespec *ts)
801 return; 801 return;
802 } 802 }
803 ppc_md.get_rtc_time(&tm); 803 ppc_md.get_rtc_time(&tm);
804
804 ts->tv_sec = mktime(tm.tm_year+1900, tm.tm_mon+1, tm.tm_mday, 805 ts->tv_sec = mktime(tm.tm_year+1900, tm.tm_mon+1, tm.tm_mday,
805 tm.tm_hour, tm.tm_min, tm.tm_sec); 806 tm.tm_hour, tm.tm_min, tm.tm_sec);
806} 807}
807 808
809void read_persistent_clock(struct timespec *ts)
810{
811 __read_persistent_clock(ts);
812
813 /* Sanitize it in case real time clock is set below EPOCH */
814 if (ts->tv_sec < 0) {
815 ts->tv_sec = 0;
816 ts->tv_nsec = 0;
817 }
818
819}
820
808/* clocksource code */ 821/* clocksource code */
809static cycle_t rtc_read(struct clocksource *cs) 822static cycle_t rtc_read(struct clocksource *cs)
810{ 823{