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


Groups > linux.kernel > #1317495

[PATCH v7 5/9] watchdog: Simplify update_worker

From Guenter Roeck <patchwork@patchwork.roeck-us.net>
Newsgroups linux.kernel
Subject [PATCH v7 5/9] watchdog: Simplify update_worker
Date 2016-01-26 04:00 +0100
Message-ID <qV21k-4Zc-19@gated-at.bofh.it> (permalink)
References <qV21j-4Zc-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Guenter Roeck <linux@roeck-us.net>

Drop 'cancel' parameter; simply cancel worker unconditionally
if not needed.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>

---
v7: Rebased to v4.5-rc1
v6: Rebased to v4.4-rc2
v5: Introduced patch
---
 drivers/watchdog/watchdog_dev.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c
index ff03cbc8e081..47e854be862c 100644
--- a/drivers/watchdog/watchdog_dev.c
+++ b/drivers/watchdog/watchdog_dev.c
@@ -122,8 +122,7 @@ static long watchdog_next_keepalive(struct watchdog_device *wdd)
 	return min_t(long, last_heartbeat - jiffies, keepalive_interval);
 }
 
-static inline void watchdog_update_worker(struct watchdog_device *wdd,
-					  bool cancel)
+static inline void watchdog_update_worker(struct watchdog_device *wdd)
 {
 	struct watchdog_core_data *wd_data = wdd->wd_data;
 
@@ -132,7 +131,7 @@ static inline void watchdog_update_worker(struct watchdog_device *wdd,
 
 		if (t > 0)
 			mod_delayed_work(watchdog_wq, &wd_data->work, t);
-	} else if (cancel) {
+	} else {
 		cancel_delayed_work(&wd_data->work);
 	}
 }
@@ -157,7 +156,7 @@ static int __watchdog_ping(struct watchdog_device *wdd)
 	else
 		err = wdd->ops->start(wdd); /* restart watchdog */
 
-	watchdog_update_worker(wdd, false);
+	watchdog_update_worker(wdd);
 
 	return err;
 }
@@ -228,7 +227,7 @@ static int watchdog_start(struct watchdog_device *wdd)
 	if (err == 0) {
 		set_bit(WDOG_ACTIVE, &wdd->status);
 		wd_data->last_keepalive = started_at;
-		watchdog_update_worker(wdd, true);
+		watchdog_update_worker(wdd);
 	}
 
 	return err;
@@ -266,7 +265,7 @@ static int watchdog_stop(struct watchdog_device *wdd)
 
 	if (err == 0) {
 		clear_bit(WDOG_ACTIVE, &wdd->status);
-		watchdog_update_worker(wdd, true);
+		watchdog_update_worker(wdd);
 	}
 
 	return err;
@@ -313,7 +312,7 @@ static int watchdog_set_timeout(struct watchdog_device *wdd,
 	else
 		wdd->timeout = timeout;
 
-	watchdog_update_worker(wdd, true);
+	watchdog_update_worker(wdd);
 
 	return err;
 }
@@ -737,7 +736,7 @@ static int watchdog_release(struct inode *inode, struct file *file)
 	}
 
 	cancel_delayed_work_sync(&wd_data->work);
-	watchdog_update_worker(wdd, false);
+	watchdog_update_worker(wdd);
 
 	/* make sure that /dev/watchdog can be re-opened */
 	clear_bit(_WDOG_DEV_OPEN, &wd_data->status);
-- 
2.1.4

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


Thread

[PATCH v7 0/9] watchdog: Add support for keepalives triggered by infrastructure Guenter Roeck <patchwork@patchwork.roeck-us.net> - 2016-01-26 04:00 +0100
  [RFT PATCH v7 7/9] watchdog: retu: Convert to use infrastructure triggered keepalives Guenter Roeck <patchwork@patchwork.roeck-us.net> - 2016-01-26 04:00 +0100
  [RFT PATCH v7 8/9] watchdog: at91sam9: Convert to use infrastructure triggered keepalives Guenter Roeck <patchwork@patchwork.roeck-us.net> - 2016-01-26 04:00 +0100
  [PATCH v7 1/9] watchdog: Introduce hardware maximum timeout in watchdog core Guenter Roeck <patchwork@patchwork.roeck-us.net> - 2016-01-26 04:00 +0100
  [RFT PATCH v7 9/9] watchdog: dw_wdt: Convert to use watchdog infrastructure Guenter Roeck <patchwork@patchwork.roeck-us.net> - 2016-01-26 04:00 +0100
  [PATCH v7 3/9] watchdog: Make set_timeout function optional Guenter Roeck <patchwork@patchwork.roeck-us.net> - 2016-01-26 04:00 +0100
  [PATCH v7 5/9] watchdog: Simplify update_worker Guenter Roeck <patchwork@patchwork.roeck-us.net> - 2016-01-26 04:00 +0100
  [PATCH v7 2/9] watchdog: Introduce WDOG_HW_RUNNING flag Guenter Roeck <patchwork@patchwork.roeck-us.net> - 2016-01-26 04:00 +0100
  [PATCH v7 4/9] watchdog: Add support for minimum time between heartbeats Guenter Roeck <patchwork@patchwork.roeck-us.net> - 2016-01-26 04:00 +0100
    Re: [PATCH v7 4/9] watchdog: Add support for minimum time between  heartbeats Uwe Kleine-König   <u.kleine-koenig@pengutronix.de> - 2016-01-26 09:10 +0100
      Re: [PATCH v7 4/9] watchdog: Add support for minimum time between  heartbeats Guenter Roeck <linux@roeck-us.net> - 2016-01-26 15:50 +0100
  Re: [PATCH v7 0/9] watchdog: Add support for keepalives triggered by  infrastructure Uwe Kleine-König   <u.kleine-koenig@pengutronix.de> - 2016-01-26 09:10 +0100
    Re: [PATCH v7 0/9] watchdog: Add support for keepalives triggered by  infrastructure Guenter Roeck <linux@roeck-us.net> - 2016-01-26 15:50 +0100

csiph-web