From: Lutz Ballaschke <vegan.grindcore@googlemail.com>
To: Giel van Schijndel <me@mortis.eu>
Cc: wim@iguana.be, linux-watchdog@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCHv3 2/3] watchdog: add f71862fg support
Date: Sun, 26 Sep 2010 16:32:41 +0200 [thread overview]
Message-ID: <20100926143241.GC2150@kreios.titan> (raw)
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;
next reply other threads:[~2010-09-26 14:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-26 14:32 Lutz Ballaschke [this message]
2010-09-26 15:19 ` Giel van Schijndel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100926143241.GC2150@kreios.titan \
--to=vegan.grindcore@googlemail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=me@mortis.eu \
--cc=wim@iguana.be \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®