Provide description for 'machdep.disable_rtc_set' sysctl. Clean up style(9)
nits. Remove a redundant return statement and an unnecessary variable.
This commit is contained in:
parent
64040d3978
commit
0674ea6f69
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=211228
@ -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) /* res has units of microseconds */
|
||||
|
||||
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) /* res has units of microseconds */
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user