From: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
To: Wim Van Sebroeck <wim@iguana.be>, Guenter Roeck <linux@roeck-us.net>
Cc: Rasmus Villemoes <rasmus.villemoes@prevas.dk>,
<linux-watchdog@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: [RFC 2/3] watchdog: introduce watchdog_worker_should_ping helper
Date: Thu, 14 Jul 2016 11:16:27 +0200 [thread overview]
Message-ID: <1468487788-22457-3-git-send-email-rasmus.villemoes@prevas.dk> (raw)
In-Reply-To: <1468487788-22457-1-git-send-email-rasmus.villemoes@prevas.dk>
This will be useful when the condition becomes slightly more
complicated in the next patch.
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
---
drivers/watchdog/watchdog_dev.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c
index 14f8a92..da549e5 100644
--- a/drivers/watchdog/watchdog_dev.c
+++ b/drivers/watchdog/watchdog_dev.c
@@ -188,18 +188,23 @@ static int watchdog_ping(struct watchdog_device *wdd)
return __watchdog_ping(wdd);
}
+static bool watchdog_worker_should_ping(struct watchdog_core_data *wd_data)
+{
+ struct watchdog_device *wdd = wd_data->wdd;
+
+ return wdd && (watchdog_active(wdd) || watchdog_hw_running(wdd));
+}
+
static void watchdog_ping_work(struct work_struct *work)
{
struct watchdog_core_data *wd_data;
- struct watchdog_device *wdd;
wd_data = container_of(to_delayed_work(work), struct watchdog_core_data,
work);
mutex_lock(&wd_data->lock);
- wdd = wd_data->wdd;
- if (wdd && (watchdog_active(wdd) || watchdog_hw_running(wdd)))
- __watchdog_ping(wdd);
+ if (watchdog_worker_should_ping(wd_data))
+ __watchdog_ping(wd_data->wdd);
mutex_unlock(&wd_data->lock);
}
--
2.5.0
next prev parent reply other threads:[~2016-07-14 9:27 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-14 9:16 [RFC 0/3] watchdog: introduce open deadline Rasmus Villemoes
2016-07-14 9:16 ` [RFC 1/3] watchdog: change watchdog_need_worker logic Rasmus Villemoes
2016-07-14 20:45 ` Guenter Roeck
2016-07-17 19:24 ` Wim Van Sebroeck
2016-07-17 19:49 ` Guenter Roeck
2016-07-17 20:30 ` Wim Van Sebroeck
2016-07-17 20:33 ` Wim Van Sebroeck
2016-07-14 9:16 ` Rasmus Villemoes [this message]
2016-07-14 9:16 ` [RFC 3/3] watchdog: introduce CONFIG_WATCHDOG_OPEN_DEADLINE Rasmus Villemoes
2016-07-14 14:42 ` Guenter Roeck
2016-07-15 7:32 ` Rasmus Villemoes
2016-07-15 14:29 ` Guenter Roeck
2016-07-20 22:08 ` Rasmus Villemoes
2016-07-21 0:31 ` Guenter Roeck
2016-07-27 20:17 ` Rasmus Villemoes
2016-07-31 22:17 ` Guenter Roeck
2016-08-01 11:10 ` Wim Van Sebroeck
2016-12-12 9:17 ` [PATCH v2 0/2] watchdog: allow setting deadline for opening /dev/watchdogN Rasmus Villemoes
2016-12-12 9:17 ` [PATCH v2 1/2] watchdog: introduce watchdog_worker_should_ping helper Rasmus Villemoes
2016-12-12 9:17 ` [PATCH v2 2/2] watchdog: introduce CONFIG_WATCHDOG_OPEN_DEADLINE Rasmus Villemoes
2016-12-12 16:59 ` Guenter Roeck
2016-12-14 13:37 ` [PATCH v3 0/2] watchdog: allow setting deadline for opening /dev/watchdogN Rasmus Villemoes
2016-12-14 13:37 ` [PATCH v3 1/2] watchdog: introduce watchdog_worker_should_ping helper Rasmus Villemoes
2016-12-14 13:37 ` [PATCH v3 2/2] watchdog: introduce CONFIG_WATCHDOG_OPEN_TIMEOUT Rasmus Villemoes
2017-01-02 15:22 ` Guenter Roeck
2017-01-03 15:52 ` Rasmus Villemoes
2017-01-03 18:59 ` Guenter Roeck
2017-01-02 8:04 ` [PATCH v3 0/2] watchdog: allow setting deadline for opening /dev/watchdogN Rasmus Villemoes
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=1468487788-22457-3-git-send-email-rasmus.villemoes@prevas.dk \
--to=rasmus.villemoes@prevas.dk \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=linux@roeck-us.net \
--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).