From: J William Piggott Date: Mon, 31 Jul 2017 15:57:01 +0000 (-0400) Subject: hwclock: remove busywait tristate return status X-Git-Tag: v2.31-rc1~144^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4a6f658cb2a881832a4f38385452c427605057b9;p=thirdparty%2Futil-linux.git hwclock: remove busywait tristate return status The select() synchronization branch only returns success or fail. There is no reason for the busywait branch to do more. If synchronization fails for any reason then it must exit, otherwise all drift correction operation will be invalid. Signed-off-by: J William Piggott --- diff --git a/sys-utils/hwclock-rtc.c b/sys-utils/hwclock-rtc.c index a660e32bab..c50011aec4 100644 --- a/sys-utils/hwclock-rtc.c +++ b/sys-utils/hwclock-rtc.c @@ -216,9 +216,8 @@ static int busywait_for_rtc_clock_tick(const struct hwclock_control *ctl, rtc_dev_name); } - rc = do_rtc_read_ioctl(rtc_fd, &start_time); - if (rc) - return RTC_BUSYWAIT_FAILED; + if (do_rtc_read_ioctl(rtc_fd, &start_time)) + return 1; /* * Wait for change. Should be within a second, but in case @@ -233,13 +232,13 @@ static int busywait_for_rtc_clock_tick(const struct hwclock_control *ctl, gettimeofday(&now, NULL); if (time_diff(now, begin) > 1.5) { warnx(_("Timed out waiting for time change.")); - return RTC_BUSYWAIT_TIMEOUT; + return 1; } } while (1); if (rc) - return RTC_BUSYWAIT_FAILED; - return RTC_BUSYWAIT_OK; + return 1; + return 0; } /* diff --git a/sys-utils/hwclock.h b/sys-utils/hwclock.h index 8843501f3b..6943d8d793 100644 --- a/sys-utils/hwclock.h +++ b/sys-utils/hwclock.h @@ -9,12 +9,6 @@ #include "c.h" -enum { - RTC_BUSYWAIT_OK = 0, - RTC_BUSYWAIT_FAILED, - RTC_BUSYWAIT_TIMEOUT -}; - struct hwclock_control { char *date_opt; char *adj_file_name;