aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Siewior <bigeasy@linutronix.de>2008-04-28 05:43:00 -0400
committerGreg Ungerer <gerg@uclinux.org>2008-07-23 01:11:28 -0400
commit0df185f5a1430ab8b437be402d286ee0728ef9f8 (patch)
treec149e6e0152a69323b09d1f1ae88ced6160a61fe
parent1fda83d83c664ad74bfec8ce093a86d4d962f093 (diff)
m68knommu: move code within time.c
This patch creates two functions do_set_rtc() and read_rtc_mmss() based on allready available code. Signed-off-by: Sebastian Siewior <bigeasy@linutronix.de> Signed-off-by: Greg Ungerer <gerg@uclinux.org>
-rw-r--r--arch/m68knommu/kernel/time.c40
1 files changed, 26 insertions, 14 deletions
diff --git a/arch/m68knommu/kernel/time.c b/arch/m68knommu/kernel/time.c
index 0ccfb2ad6380..d33ed9a84cc7 100644
--- a/arch/m68knommu/kernel/time.c
+++ b/arch/m68knommu/kernel/time.c
@@ -33,22 +33,11 @@ static inline int set_rtc_mmss(unsigned long nowtime)
33 return -1; 33 return -1;
34} 34}
35 35
36/* 36static inline void do_set_rtc(void)
37 * timer_interrupt() needs to keep up the real-time clock,
38 * as well as call the "do_timer()" routine every clocktick
39 */
40irqreturn_t arch_timer_interrupt(int irq, void *dummy)
41{ 37{
42 /* last time the cmos clock got updated */ 38 /* last time the cmos clock got updated */
43 static long last_rtc_update=0; 39 static long last_rtc_update=0;
44 40
45 if (current->pid)
46 profile_tick(CPU_PROFILING);
47
48 write_seqlock(&xtime_lock);
49
50 do_timer(1);
51
52 /* 41 /*
53 * If we have an externally synchronized Linux clock, then update 42 * If we have an externally synchronized Linux clock, then update
54 * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be 43 * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be
@@ -63,6 +52,23 @@ irqreturn_t arch_timer_interrupt(int irq, void *dummy)
63 else 52 else
64 last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */ 53 last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */
65 } 54 }
55}
56
57/*
58 * timer_interrupt() needs to keep up the real-time clock,
59 * as well as call the "do_timer()" routine every clocktick
60 */
61irqreturn_t arch_timer_interrupt(int irq, void *dummy)
62{
63
64 if (current->pid)
65 profile_tick(CPU_PROFILING);
66
67 write_seqlock(&xtime_lock);
68
69 do_timer(1);
70
71 do_set_rtc();
66 72
67 write_sequnlock(&xtime_lock); 73 write_sequnlock(&xtime_lock);
68 74
@@ -72,7 +78,7 @@ irqreturn_t arch_timer_interrupt(int irq, void *dummy)
72 return(IRQ_HANDLED); 78 return(IRQ_HANDLED);
73} 79}
74 80
75void time_init(void) 81static unsigned long read_rtc_mmss(void)
76{ 82{
77 unsigned int year, mon, day, hour, min, sec; 83 unsigned int year, mon, day, hour, min, sec;
78 84
@@ -83,7 +89,13 @@ void time_init(void)
83 89
84 if ((year += 1900) < 1970) 90 if ((year += 1900) < 1970)
85 year += 100; 91 year += 100;
86 xtime.tv_sec = mktime(year, mon, day, hour, min, sec); 92
93 return mktime(year, mon, day, hour, min, sec);;
94}
95
96void time_init(void)
97{
98 xtime.tv_sec = read_rtc_mmss();
87 xtime.tv_nsec = 0; 99 xtime.tv_nsec = 0;
88 wall_to_monotonic.tv_sec = -xtime.tv_sec; 100 wall_to_monotonic.tv_sec = -xtime.tv_sec;
89 101