From c6e064200d262435083af7c3a2367775b93aaabf Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Mon, 18 Aug 2014 11:25:16 +0200 Subject: [PATCH] rtc: move preinit call to RTC_Initialise() --- main.c | 6 +----- rtc.c | 20 +++++++------------- rtc.h | 3 +-- 3 files changed, 9 insertions(+), 20 deletions(-) diff --git a/main.c b/main.c index 4b11dc4..868cb7f 100644 --- a/main.c +++ b/main.c @@ -452,16 +452,12 @@ int main * be done *AFTER* the daemon-creation fork() */ write_lockfile(); - if (do_init_rtc) { - RTC_TimePreInit(); - } - LCL_Initialise(); SCH_Initialise(); SYS_Initialise(); NIO_Initialise(address_family); CAM_Initialise(address_family); - RTC_Initialise(); + RTC_Initialise(do_init_rtc); SRC_Initialise(); RCL_Initialise(); KEY_Initialise(); diff --git a/rtc.c b/rtc.c index 5b2ccf9..90828d0 100644 --- a/rtc.c +++ b/rtc.c @@ -74,10 +74,16 @@ static struct { /* ================================================== */ void -RTC_Initialise(void) +RTC_Initialise(int initial_set) { char *file_name; + /* Do an initial read of the RTC and set the system time to it. This + is analogous to what /sbin/hwclock -s would do on Linux. */ + if (initial_set && driver.time_pre_init) { + (driver.time_pre_init)(); + } + driver_initialised = 0; /* This is how we tell whether the user wants to load the RTC @@ -130,18 +136,6 @@ RTC_TimeInit(void (*after_hook)(void *), void *anything) } } -/* ================================================== */ -/* Do an initial read of the RTC and set the system time to it. This - is analogous to what /sbin/hwclock -s would do on Linux. */ - -void -RTC_TimePreInit(void) -{ - if (driver.time_pre_init) { - (driver.time_pre_init)(); - } -} - /* ================================================== */ /* Start the RTC measurement process */ diff --git a/rtc.h b/rtc.h index da60bc7..8fd677b 100644 --- a/rtc.h +++ b/rtc.h @@ -28,9 +28,8 @@ #include "reports.h" -extern void RTC_Initialise(void); +extern void RTC_Initialise(int initial_set); extern void RTC_Finalise(void); -extern void RTC_TimePreInit(void); extern void RTC_TimeInit(void (*after_hook)(void *), void *anything); extern void RTC_StartMeasurements(void); extern int RTC_GetReport(RPT_RTC_Report *report);