diff options
Diffstat (limited to 'drivers/char/watchdog/pcwd_usb.c')
-rw-r--r-- | drivers/char/watchdog/pcwd_usb.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/char/watchdog/pcwd_usb.c b/drivers/char/watchdog/pcwd_usb.c index 3fdfda9324fa..0d072bed501d 100644 --- a/drivers/char/watchdog/pcwd_usb.c +++ b/drivers/char/watchdog/pcwd_usb.c | |||
@@ -317,6 +317,19 @@ static int usb_pcwd_get_temperature(struct usb_pcwd_private *usb_pcwd, int *temp | |||
317 | return 0; | 317 | return 0; |
318 | } | 318 | } |
319 | 319 | ||
320 | static int usb_pcwd_get_timeleft(struct usb_pcwd_private *usb_pcwd, int *time_left) | ||
321 | { | ||
322 | unsigned char msb, lsb; | ||
323 | |||
324 | /* Read the time that's left before rebooting */ | ||
325 | /* Note: if the board is not yet armed then we will read 0xFFFF */ | ||
326 | usb_pcwd_send_command(usb_pcwd, CMD_READ_WATCHDOG_TIMEOUT, &msb, &lsb); | ||
327 | |||
328 | *time_left = (msb << 8) + lsb; | ||
329 | |||
330 | return 0; | ||
331 | } | ||
332 | |||
320 | /* | 333 | /* |
321 | * /dev/watchdog handling | 334 | * /dev/watchdog handling |
322 | */ | 335 | */ |
@@ -422,6 +435,16 @@ static int usb_pcwd_ioctl(struct inode *inode, struct file *file, | |||
422 | case WDIOC_GETTIMEOUT: | 435 | case WDIOC_GETTIMEOUT: |
423 | return put_user(heartbeat, p); | 436 | return put_user(heartbeat, p); |
424 | 437 | ||
438 | case WDIOC_GETTIMELEFT: | ||
439 | { | ||
440 | int time_left; | ||
441 | |||
442 | if (usb_pcwd_get_timeleft(usb_pcwd_device, &time_left)) | ||
443 | return -EFAULT; | ||
444 | |||
445 | return put_user(time_left, p); | ||
446 | } | ||
447 | |||
425 | default: | 448 | default: |
426 | return -ENOIOCTLCMD; | 449 | return -ENOIOCTLCMD; |
427 | } | 450 | } |