svn commit: r211228 - head/sys/kern
Jung-uk Kim
jkim at FreeBSD.org
Thu Aug 12 16:13:25 UTC 2010
Author: jkim
Date: Thu Aug 12 16:13:24 2010
New Revision: 211228
URL: http://svn.freebsd.org/changeset/base/211228
Log:
Provide description for 'machdep.disable_rtc_set' sysctl. Clean up style(9)
nits. Remove a redundant return statement and an unnecessary variable.
Modified:
head/sys/kern/subr_rtc.c
Modified: head/sys/kern/subr_rtc.c
==============================================================================
--- head/sys/kern/subr_rtc.c Thu Aug 12 15:46:15 2010 (r211227)
+++ head/sys/kern/subr_rtc.c Thu Aug 12 16:13:24 2010 (r211228)
@@ -65,8 +65,8 @@ static long clock_res;
/* XXX: should be kern. now, it's no longer machdep. */
static int disable_rtc_set;
-SYSCTL_INT(_machdep, OID_AUTO, disable_rtc_set,
- CTLFLAG_RW, &disable_rtc_set, 0, "");
+SYSCTL_INT(_machdep, OID_AUTO, disable_rtc_set, CTLFLAG_RW, &disable_rtc_set,
+ 0, "Disallow adjusting time-of-day clock");
void
clock_register(device_t dev, long res) /* res has units of microseconds */
@@ -74,26 +74,22 @@ clock_register(device_t dev, long res) /
if (clock_dev != NULL) {
if (clock_res > res) {
- if (bootverbose) {
+ if (bootverbose)
device_printf(dev, "not installed as "
"time-of-day clock: clock %s has higher "
"resolution\n", device_get_name(clock_dev));
- }
return;
- } else {
- if (bootverbose) {
- device_printf(clock_dev, "removed as "
- "time-of-day clock: clock %s has higher "
- "resolution\n", device_get_name(dev));
- }
}
+ if (bootverbose)
+ device_printf(clock_dev, "removed as "
+ "time-of-day clock: clock %s has higher "
+ "resolution\n", device_get_name(dev));
}
clock_dev = dev;
clock_res = res;
- if (bootverbose) {
+ if (bootverbose)
device_printf(dev, "registered as a time-of-day clock "
"(resolution %ldus)\n", res);
- }
}
/*
@@ -109,7 +105,7 @@ clock_register(device_t dev, long res) /
void
inittodr(time_t base)
{
- struct timespec ref, ts;
+ struct timespec ts;
int error;
if (clock_dev == NULL) {
@@ -136,9 +132,9 @@ inittodr(time_t base)
wrong_time:
if (base > 0) {
- ref.tv_sec = base;
- ref.tv_nsec = 0;
- tc_setclock(&ref);
+ ts.tv_sec = base;
+ ts.tv_nsec = 0;
+ tc_setclock(&ts);
}
}
@@ -157,9 +153,7 @@ resettodr(void)
getnanotime(&ts);
ts.tv_sec -= utc_offset();
/* XXX: We should really set all registered RTCs */
- if ((error = CLOCK_SETTIME(clock_dev, &ts)) != 0) {
+ if ((error = CLOCK_SETTIME(clock_dev, &ts)) != 0)
printf("warning: clock_settime failed (%d), time-of-day clock "
"not adjusted to system time\n", error);
- return;
- }
}
More information about the svn-src-head
mailing list