svn commit: r321795 - head/sys/dev/iicbus
Ian Lepore
ian at FreeBSD.org
Mon Jul 31 15:24:42 UTC 2017
Author: ian
Date: Mon Jul 31 15:24:40 2017
New Revision: 321795
URL: https://svnweb.freebsd.org/changeset/base/321795
Log:
Check the clock-halted flag every time the clock is read, not just once
at startup. The flag stays set until the clock is loaded with good time,
so we need to keep saying the time is invalid until that happens.
Modified:
head/sys/dev/iicbus/ds1307.c
Modified: head/sys/dev/iicbus/ds1307.c
==============================================================================
--- head/sys/dev/iicbus/ds1307.c Mon Jul 31 15:23:19 2017 (r321794)
+++ head/sys/dev/iicbus/ds1307.c Mon Jul 31 15:24:40 2017 (r321795)
@@ -328,6 +328,10 @@ ds1307_gettime(device_t dev, struct timespec *ts)
return (error);
}
+ /* If the clock halted, we don't have good data. */
+ if (data[DS1307_SECS] & DS1307_SECS_CH)
+ return (EINVAL);
+
/* If chip is in AM/PM mode remember that. */
if (data[DS1307_HOUR] & DS1307_HOUR_USE_AMPM) {
sc->sc_use_ampm = true;
More information about the svn-src-all
mailing list