Sebastian Siewior
Tue, 08 Apr 2008 10:51:36 -0700
This patch creates two functions do_set_rtc() and read_rtc_mmss() based on allready available code.
Signed-off-by: Sebastian Siewior <[EMAIL PROTECTED]>
--- a/arch/m68knommu/kernel/time.c
+++ b/arch/m68knommu/kernel/time.c
@@ -33,24 +33,11 @@ static inline int set_rtc_mmss(unsigned
return -1;
}
-/*
- * timer_interrupt() needs to keep up the real-time clock,
- * as well as call the "do_timer()" routine every clocktick
- */
-irqreturn_t arch_timer_interrupt(int irq, void *dummy)
+static inline void do_set_rtc(void)
{
/* last time the cmos clock got updated */
static long last_rtc_update=0;
- write_seqlock(&xtime_lock);
-
- do_timer(1);
-#ifndef CONFIG_SMP
- update_process_times(user_mode(get_irq_regs()));
-#endif
- if (current->pid)
- profile_tick(CPU_PROFILING);
-
/*
* If we have an externally synchronized Linux clock, then update
* CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be
@@ -65,12 +52,31 @@ irqreturn_t arch_timer_interrupt(int irq
else
last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */
}
+}
+
+/*
+ * timer_interrupt() needs to keep up the real-time clock,
+ * as well as call the "do_timer()" routine every clocktick
+ */
+irqreturn_t arch_timer_interrupt(int irq, void *dummy)
+{
+
+ write_seqlock(&xtime_lock);
+
+ do_timer(1);
+#ifndef CONFIG_SMP
+ update_process_times(user_mode(get_irq_regs()));
+#endif
+ if (current->pid)
+ profile_tick(CPU_PROFILING);
+
+ do_set_rtc();
write_sequnlock(&xtime_lock);
return(IRQ_HANDLED);
}
-void time_init(void)
+static unsigned long read_rtc_mmss(void)
{
unsigned int year, mon, day, hour, min, sec;
@@ -81,7 +87,13 @@ void time_init(void)
if ((year += 1900) < 1970)
year += 100;
- xtime.tv_sec = mktime(year, mon, day, hour, min, sec);
+
+ return mktime(year, mon, day, hour, min, sec);;
+}
+
+void time_init(void)
+{
+ xtime.tv_sec = read_rtc_mmss();
xtime.tv_nsec = 0;
wall_to_monotonic.tv_sec = -xtime.tv_sec;
--
_______________________________________________
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev