Skip to contentSkip to conversation

watchdog: hpwdt (8/12): implement WDIOC_GETTIMELEFT

PATCH Wim Van Sebroeck 1 participant 1 message Aug 6, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

commit b2aad696c01e7d4b997de569ca5168cc24782d63

Author: dann frazier <[email protected]>
Date:   Wed Jun 2 16:23:41 2010 -0600

watchdog: hpwdt (8/12): implement WDIOC_GETTIMELEFT

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

drivers/watchdog/hpwdt.c +9 -0
index 0029991..554526c 100644
@@ -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;
 }