[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1468487788-22457-3-git-send-email-rasmus.villemoes@prevas.dk>
Date: Thu, 14 Jul 2016 11:16:27 +0200
From: Rasmus Villemoes <rasmus.villemoes@...vas.dk>
To: Wim Van Sebroeck <wim@...ana.be>,
Guenter Roeck <linux@...ck-us.net>
CC: Rasmus Villemoes <rasmus.villemoes@...vas.dk>,
<linux-watchdog@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: [RFC 2/3] watchdog: introduce watchdog_worker_should_ping helper
This will be useful when the condition becomes slightly more
complicated in the next patch.
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@...vas.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
Powered by blists - more mailing lists