瀏覽代碼

watchdog: hpwdt (8/12): implement WDIOC_GETTIMELEFT

Let applications check the amount of time left before the watchdog will fire.

Signed-off-by: dann frazier <dannf@hp.com>
Acked-by: Thomas Mingarelli <Thomas.Mingarelli@hp.com>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
dann frazier 15 年之前
父節點
當前提交
aae67f3602
共有 1 個文件被更改,包括 9 次插入0 次删除
  1. 9 0
      drivers/watchdog/hpwdt.c

+ 9 - 0
drivers/watchdog/hpwdt.c

@@ -450,6 +450,11 @@ static int hpwdt_change_timer(int new_margin)
 	return 0;
 }
 
+static int hpwdt_time_left(void)
+{
+	return TICKS_TO_SECS(ioread16(hpwdt_timer_reg));
+}
+
 /*
  *	NMI Handler
  */
@@ -591,6 +596,10 @@ static long hpwdt_ioctl(struct file *file, unsigned int cmd,
 	case WDIOC_GETTIMEOUT:
 		ret = put_user(soft_margin, p);
 		break;
+
+	case WDIOC_GETTIMELEFT:
+		ret = put_user(hpwdt_time_left(), p);
+		break;
 	}
 	return ret;
 }