linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: dann frazier <dannf@hp.com>
To: Wim Van Sebroeck <wim@iguana.be>
Cc: linux-kernel@vger.kernel.org,
	Thomas Mingarelli <thomas.mingarelli@hp.com>,
	dann frazier <dannf@hp.com>
Subject: [PATCH 3/3] hpwdt: implement WDIOC_GETTIMELEFT
Date: Wed,  2 Jun 2010 16:23:41 -0600	[thread overview]
Message-ID: <1275517421-10544-3-git-send-email-dannf@hp.com> (raw)
In-Reply-To: <1275517421-10544-1-git-send-email-dannf@hp.com>

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

Signed-off-by: dann frazier <dannf@hp.com>
---
 drivers/watchdog/hpwdt.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/drivers/watchdog/hpwdt.c b/drivers/watchdog/hpwdt.c
index e3bf645..dbe650e 100644
--- a/drivers/watchdog/hpwdt.c
+++ b/drivers/watchdog/hpwdt.c
@@ -443,6 +443,11 @@ static void hpwdt_ping(void)
 	iowrite16(reload, hpwdt_timer_reg);
 }
 
+static int hpwdt_time_left(void)
+{
+	return TICKS_TO_SECS(ioread16(hpwdt_timer_reg));
+}
+
 static int hpwdt_change_timer(int new_margin)
 {
 	if (new_margin < 1 || new_margin > HPWDT_MAX_TIMER) {
@@ -583,6 +588,10 @@ static long hpwdt_ioctl(struct file *file, unsigned int cmd,
 		ret = put_user(0, p);
 		break;
 
+	case WDIOC_GETTIMELEFT:
+		ret = put_user(hpwdt_time_left(), p);
+		break;
+
 	case WDIOC_KEEPALIVE:
 		hpwdt_ping();
 		ret = 0;
-- 
1.7.1


      parent reply	other threads:[~2010-06-02 22:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-02 22:23 [PATCH 1/3] hpwdt: Introduce SECS_TO_TICKS() macro dann frazier
2010-06-02 22:23 ` [PATCH 2/3] hpwdt: allow full range of timer values supported by hardware dann frazier
2010-06-02 22:23 ` dann frazier [this message]

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=1275517421-10544-3-git-send-email-dannf@hp.com \
    --to=dannf@hp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=thomas.mingarelli@hp.com \
    --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;
as well as URLs for NNTP newsgroup(s).