From: Wolfram Sang <wsa@the-dreams.de>
To: linux-watchdog@vger.kernel.org
Cc: Wolfram Sang <wsa@the-dreams.de>,
linux-renesas-soc@vger.kernel.org,
Guenter Roeck <linux@roeck-us.net>,
Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>,
Robin Gong <b38343@freescale.com>
Subject: [PATCH 7/7] watchdog: softdog: implement pretimeout support
Date: Wed, 25 May 2016 15:32:31 +0200 [thread overview]
Message-ID: <1464183151-4912-8-git-send-email-wsa@the-dreams.de> (raw)
In-Reply-To: <1464183151-4912-1-git-send-email-wsa@the-dreams.de>
From: Wolfram Sang <wsa+renesas@sang-engineering.com>
Give devices which do not have hardware support for pretimeout at least a
software version of it.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
drivers/watchdog/softdog.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/drivers/watchdog/softdog.c b/drivers/watchdog/softdog.c
index b067edf246dff2..adfb3899296f0f 100644
--- a/drivers/watchdog/softdog.c
+++ b/drivers/watchdog/softdog.c
@@ -72,10 +72,25 @@ static void softdog_fire(unsigned long data)
static struct timer_list softdog_ticktock =
TIMER_INITIALIZER(softdog_fire, 0, 0);
+static struct watchdog_device softdog_dev;
+
+static void softdog_pretimeout(unsigned long data)
+{
+ watchdog_notify_pretimeout(&softdog_dev);
+}
+
+static struct timer_list softdog_preticktock =
+ TIMER_INITIALIZER(softdog_pretimeout, 0, 0);
+
static int softdog_ping(struct watchdog_device *w)
{
if (!mod_timer(&softdog_ticktock, jiffies + (w->timeout * HZ)))
__module_get(THIS_MODULE);
+
+ if (w->pretimeout)
+ mod_timer(&softdog_preticktock, jiffies +
+ (w->timeout - w->pretimeout) * HZ);
+
return 0;
}
@@ -84,12 +99,15 @@ static int softdog_stop(struct watchdog_device *w)
if (del_timer(&softdog_ticktock))
module_put(THIS_MODULE);
+ del_timer(&softdog_preticktock);
+
return 0;
}
static struct watchdog_info softdog_info = {
.identity = "Software Watchdog",
- .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE,
+ .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE |
+ WDIOF_PRETIMEOUT,
};
static struct watchdog_ops softdog_ops = {
--
2.8.1
prev parent reply other threads:[~2016-05-25 13:32 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-25 13:32 [PATCH 0/7] watchdog: add pretimeout support Wolfram Sang
2016-05-25 13:32 ` [PATCH 1/7] watchdog: add watchdog pretimeout framework Wolfram Sang
2016-05-26 14:11 ` Vladimir Zapolskiy
2016-05-26 16:41 ` Wolfram Sang
2016-05-26 22:37 ` Guenter Roeck
2016-06-05 9:48 ` Wolfram Sang
2016-06-05 20:25 ` Vladimir Zapolskiy
2016-05-25 13:32 ` [PATCH 2/7] watchdog: pretimeout: add panic pretimeout governor Wolfram Sang
2016-05-25 13:32 ` [PATCH 3/7] watchdog: pretimeout: add noop " Wolfram Sang
2016-05-25 13:32 ` [PATCH 4/7] watchdog: documentation: squash paragraphs about 'no set_timeout' Wolfram Sang
2016-05-25 13:32 ` [PATCH 5/7] watchdog: add pretimeout support to the core Wolfram Sang
2016-05-25 13:32 ` [PATCH 6/7] fs: compat_ioctl: add pretimeout functions for watchdogs Wolfram Sang
2016-05-25 13:32 ` Wolfram Sang [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=1464183151-4912-8-git-send-email-wsa@the-dreams.de \
--to=wsa@the-dreams.de \
--cc=b38343@freescale.com \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=vladimir_zapolskiy@mentor.com \
/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).