diff options
author | n_hibma <n_hibma@FreeBSD.org> | 2007-03-27 21:03:37 +0000 |
---|---|---|
committer | n_hibma <n_hibma@FreeBSD.org> | 2007-03-27 21:03:37 +0000 |
commit | 2e4f7510d94a26f1cd9ae67ea9c88535cea9c193 (patch) | |
tree | c7550e0408ca0d79f56a9e6d3c0a0ca79a6f86e2 /sys/dev | |
parent | 2f20235351089bb6e52be91ffa6c7bf6ded46a69 (diff) | |
download | FreeBSD-src-2e4f7510d94a26f1cd9ae67ea9c88535cea9c193.zip FreeBSD-src-2e4f7510d94a26f1cd9ae67ea9c88535cea9c193.tar.gz |
Revisit the watchdogs: Resetting the error to EINVAL after failing to set the
watchdog might hide the succesful arming of an earlier one. Accept that on
failing to arm any watchdog (because of non-supported timeouts) EOPNOTSUPP is
returned instead of the more appropriate EINVAL.
MFC after: 3 days
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/ichwd/ichwd.c | 2 | ||||
-rw-r--r-- | sys/dev/ipmi/ipmi.c | 2 | ||||
-rw-r--r-- | sys/dev/mk48txx/mk48txx.c | 8 | ||||
-rw-r--r-- | sys/dev/watchdog/watchdog.c | 2 |
4 files changed, 6 insertions, 8 deletions
diff --git a/sys/dev/ichwd/ichwd.c b/sys/dev/ichwd/ichwd.c index a109f80..86d9ad3 100644 --- a/sys/dev/ichwd/ichwd.c +++ b/sys/dev/ichwd/ichwd.c @@ -194,8 +194,6 @@ ichwd_event(void *arg, unsigned int cmd, int *error) } else { if (sc->active) ichwd_tmr_disable(sc); - if (cmd > 0) - *error = EINVAL; } } diff --git a/sys/dev/ipmi/ipmi.c b/sys/dev/ipmi/ipmi.c index 12cf3f5..d42aedc 100644 --- a/sys/dev/ipmi/ipmi.c +++ b/sys/dev/ipmi/ipmi.c @@ -656,8 +656,6 @@ ipmi_wd_event(void *arg, unsigned int cmd, int *error) *error = 0; } else { ipmi_set_watchdog(sc, 0); - if (cmd > 0) - *error = 0; } } diff --git a/sys/dev/mk48txx/mk48txx.c b/sys/dev/mk48txx/mk48txx.c index fbc03c4..71ab8f5 100644 --- a/sys/dev/mk48txx/mk48txx.c +++ b/sys/dev/mk48txx/mk48txx.c @@ -295,9 +295,9 @@ mk48txx_watchdog(void *arg, u_int cmd, int *error) dev = arg; sc = device_get_softc(dev); - wdog = 0; t = cmd & WD_INTERVAL; - if (cmd > 0 && t >= 26 && t <= 37) { + if (t >= 26 && t <= 37) { + wdog = 0; if (t <= WD_TO_2SEC) { wdog |= MK48TXX_WDOG_RB_1_16; t -= 26; @@ -317,8 +317,8 @@ mk48txx_watchdog(void *arg, u_int cmd, int *error) if (sc->sc_flag & MK48TXX_WDOG_ENABLE_WDS) wdog |= MK48TXX_WDOG_WDS; *error = 0; - } else if (cmd > 0) { - *error = EINVAL; + } else { + wdog = 0; } mtx_lock(&sc->sc_mtx); (*sc->sc_nvwr)(dev, sc->sc_clkoffset + MK48TXX_WDOG, wdog); diff --git a/sys/dev/watchdog/watchdog.c b/sys/dev/watchdog/watchdog.c index a1d8d88..06498c9 100644 --- a/sys/dev/watchdog/watchdog.c +++ b/sys/dev/watchdog/watchdog.c @@ -55,6 +55,8 @@ wd_ioctl(struct cdev *dev __unused, u_long cmd, caddr_t data, return (EINVAL); if ((u & (WD_ACTIVE | WD_PASSIVE)) == (WD_ACTIVE | WD_PASSIVE)) return (EINVAL); + if ((u & (WD_ACTIVE | WD_PASSIVE)) == 0 && (u & WD_INTERVAL) > 0) + return (EINVAL); if (u & WD_PASSIVE) return (ENOSYS); /* XXX Not implemented yet */ if ((u & WD_INTERVAL) == WD_TO_NEVER) { |