mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-23 09:19:51 +00:00
watchdog: core: propagate ping error code to the user space
Watchdog ping return errors are ignored by watchdog core, Whatchdog daemon should be informed about possible hardware error or underlaying device driver get unregistered. Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com> Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
This commit is contained in:
parent
bc794ac3b5
commit
5ef796639c
1 changed files with 8 additions and 4 deletions
|
@ -294,6 +294,7 @@ static ssize_t watchdog_write(struct file *file, const char __user *data,
|
||||||
struct watchdog_device *wdd = file->private_data;
|
struct watchdog_device *wdd = file->private_data;
|
||||||
size_t i;
|
size_t i;
|
||||||
char c;
|
char c;
|
||||||
|
int err;
|
||||||
|
|
||||||
if (len == 0)
|
if (len == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -313,7 +314,9 @@ static ssize_t watchdog_write(struct file *file, const char __user *data,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* someone wrote to us, so we send the watchdog a keepalive ping */
|
/* someone wrote to us, so we send the watchdog a keepalive ping */
|
||||||
watchdog_ping(wdd);
|
err = watchdog_ping(wdd);
|
||||||
|
if (err < 0)
|
||||||
|
return err;
|
||||||
|
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
@ -369,8 +372,7 @@ static long watchdog_ioctl(struct file *file, unsigned int cmd,
|
||||||
case WDIOC_KEEPALIVE:
|
case WDIOC_KEEPALIVE:
|
||||||
if (!(wdd->info->options & WDIOF_KEEPALIVEPING))
|
if (!(wdd->info->options & WDIOF_KEEPALIVEPING))
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
watchdog_ping(wdd);
|
return watchdog_ping(wdd);
|
||||||
return 0;
|
|
||||||
case WDIOC_SETTIMEOUT:
|
case WDIOC_SETTIMEOUT:
|
||||||
if (get_user(val, p))
|
if (get_user(val, p))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
@ -380,7 +382,9 @@ static long watchdog_ioctl(struct file *file, unsigned int cmd,
|
||||||
/* If the watchdog is active then we send a keepalive ping
|
/* If the watchdog is active then we send a keepalive ping
|
||||||
* to make sure that the watchdog keep's running (and if
|
* to make sure that the watchdog keep's running (and if
|
||||||
* possible that it takes the new timeout) */
|
* possible that it takes the new timeout) */
|
||||||
watchdog_ping(wdd);
|
err = watchdog_ping(wdd);
|
||||||
|
if (err < 0)
|
||||||
|
return err;
|
||||||
/* Fall */
|
/* Fall */
|
||||||
case WDIOC_GETTIMEOUT:
|
case WDIOC_GETTIMEOUT:
|
||||||
/* timeout == 0 means that we don't know the timeout */
|
/* timeout == 0 means that we don't know the timeout */
|
||||||
|
|
Loading…
Reference in a new issue