mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCHv3 2/3] watchdog: add f71862fg support
@ 2010-09-26 14:32 Lutz Ballaschke
  2010-09-26 15:19 ` Giel van Schijndel
  0 siblings, 1 reply; 2+ messages in thread
From: Lutz Ballaschke @ 2010-09-26 14:32 UTC (permalink / raw)
  To: Giel van Schijndel; +Cc: wim, linux-watchdog, linux-kernel

from: Lutz Ballaschke <vegan.grindcore@googlemail.com>

ioctl WDIOC_GETTIMELEFT and helper function added to watchdog driver 
for common usage.

Signed-off-by: Lutz Ballaschke <vegan.grindcore@googlemail.com>
---

 drivers/watchdog/f71808e_wdt.c |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)


diff --git a/drivers/watchdog/f71808e_wdt.c b/drivers/watchdog/f71808e_wdt.c
index 546cef6..d070086 100644
--- a/drivers/watchdog/f71808e_wdt.c
+++ b/drivers/watchdog/f71808e_wdt.c
@@ -265,6 +265,24 @@ exit_unlock:
 	return err;
 }
 
+static int watchdog_time_left(void)
+{
+	int ret = 0;
+
+	mutex_lock(&watchdog.lock);
+	ret = superio_enter(watchdog.sioaddr);
+	if (ret)
+		goto exit_unlock;
+
+	superio_select(watchdog.sioaddr, SIO_F71808FG_LD_WDT);
+	ret = superio_inb(watchdog.sioaddr, F71808FG_REG_WD_TIME);
+	superio_exit(watchdog.sioaddr);
+
+exit_unlock:
+	mutex_unlock(&watchdog.lock);
+	return ret;
+}
+
 static int watchdog_keepalive(void)
 {
 	int err = 0;
@@ -590,6 +608,12 @@ static long watchdog_ioctl(struct file *file, unsigned int cmd,
 	case WDIOC_GETTIMEOUT:
 		return put_user(watchdog.timeout, uarg.i);
 
+	case WDIOC_GETTIMELEFT:
+		status = watchdog_time_left();
+		if (status < 0)
+			return status;
+		return put_user(status, uarg.i);
+
 	default:
 		return -ENOTTY;
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-09-26 15:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-26 14:32 [PATCHv3 2/3] watchdog: add f71862fg support Lutz Ballaschke
2010-09-26 15:19 ` Giel van Schijndel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®