Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1443312

[RFC 2/3] watchdog: introduce watchdog_worker_should_ping helper

From Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Newsgroups linux.kernel
Subject [RFC 2/3] watchdog: introduce watchdog_worker_should_ping helper
Date 2016-07-14 11:30 +0200
Message-ID <rUL7X-7Qb-7@gated-at.bofh.it> (permalink)
References <rUL7X-7Qb-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC 0/3] watchdog: introduce open deadline Rasmus Villemoes <rasmus.villemoes@prevas.dk> - 2016-07-14 11:30 +0200
  [RFC 2/3] watchdog: introduce watchdog_worker_should_ping helper Rasmus Villemoes <rasmus.villemoes@prevas.dk> - 2016-07-14 11:30 +0200
  [RFC 1/3] watchdog: change watchdog_need_worker logic Rasmus Villemoes <rasmus.villemoes@prevas.dk> - 2016-07-14 11:30 +0200
    Re: [RFC 1/3] watchdog: change watchdog_need_worker logic Guenter Roeck <linux@roeck-us.net> - 2016-07-14 22:50 +0200
    Re: [RFC 1/3] watchdog: change watchdog_need_worker logic Wim Van Sebroeck <wim@iguana.be> - 2016-07-17 21:50 +0200
      Re: [RFC 1/3] watchdog: change watchdog_need_worker logic Guenter Roeck <linux@roeck-us.net> - 2016-07-17 22:00 +0200
        Re: [RFC 1/3] watchdog: change watchdog_need_worker logic Wim Van Sebroeck <wim@iguana.be> - 2016-07-17 22:40 +0200
  [RFC 3/3] watchdog: introduce CONFIG_WATCHDOG_OPEN_DEADLINE Rasmus Villemoes <rasmus.villemoes@prevas.dk> - 2016-07-14 11:30 +0200
    Re: [RFC 3/3] watchdog: introduce CONFIG_WATCHDOG_OPEN_DEADLINE Guenter Roeck <linux@roeck-us.net> - 2016-07-14 16:50 +0200
      Re: [RFC 3/3] watchdog: introduce CONFIG_WATCHDOG_OPEN_DEADLINE Rasmus Villemoes <rasmus.villemoes@prevas.dk> - 2016-07-15 09:50 +0200
        Re: [RFC 3/3] watchdog: introduce CONFIG_WATCHDOG_OPEN_DEADLINE Guenter Roeck <linux@roeck-us.net> - 2016-07-15 16:30 +0200
          Re: [RFC 3/3] watchdog: introduce CONFIG_WATCHDOG_OPEN_DEADLINE Rasmus Villemoes <rasmus.villemoes@prevas.dk> - 2016-07-21 00:20 +0200
            Re: [RFC 3/3] watchdog: introduce CONFIG_WATCHDOG_OPEN_DEADLINE Guenter Roeck <linux@roeck-us.net> - 2016-07-21 02:40 +0200

csiph-web