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


Groups > linux.kernel > #1275033

[PATCH v5 5/8] watchdog: Simplify update_worker

From Guenter Roeck <linux@roeck-us.net>
Newsgroups linux.kernel
Subject [PATCH v5 5/8] watchdog: Simplify update_worker
Date 2015-11-23 04:30 +0100
Message-ID <qxPZg-4Er-17@gated-at.bofh.it> (permalink)
References <qxPZf-4Er-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
v5: Added 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 832bd5ac15b5..722ea86fcc7c 100644
--- a/drivers/watchdog/watchdog_dev.c
+++ b/drivers/watchdog/watchdog_dev.c
@@ -96,15 +96,14 @@ 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)
 {
 	if (watchdog_need_worker(wdd)) {
 		long t = watchdog_next_keepalive(wdd);
 
 		if (t > 0)
 			mod_delayed_work(watchdog_wq, &wdd->work, t);
-	} else if (cancel) {
+	} else {
 		cancel_delayed_work(&wdd->work);
 	}
 }
@@ -133,7 +132,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;
 }
@@ -198,7 +197,7 @@ static int watchdog_start(struct watchdog_device *wdd)
 	if (err == 0) {
 		set_bit(WDOG_ACTIVE, &wdd->status);
 		wdd->last_keepalive = jiffies;
-		watchdog_update_worker(wdd, true);
+		watchdog_update_worker(wdd);
 	}
 
 out_start:
@@ -243,7 +242,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);
 	}
 
 out_stop:
@@ -311,7 +310,7 @@ static int watchdog_set_timeout(struct watchdog_device *wdd,
 	else
 		wdd->timeout = timeout;
 
-	watchdog_update_worker(wdd, true);
+	watchdog_update_worker(wdd);
 
 out_timeout:
 	mutex_unlock(&wdd->lock);
@@ -590,7 +589,7 @@ static int watchdog_release(struct inode *inode, struct file *file)
 	}
 
 	cancel_delayed_work_sync(&wdd->work);
-	watchdog_update_worker(wdd, false);
+	watchdog_update_worker(wdd);
 
 	/*
 	 * Allow the owner module to be unloaded again unless the watchdog
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

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


Thread

[PATCH v5 0/8] watchdog: Add support for keepalives triggered by infrastructure Guenter Roeck <linux@roeck-us.net> - 2015-11-23 04:30 +0100
  [PATCH v5 3/8] watchdog: Make set_timeout function optional Guenter Roeck <linux@roeck-us.net> - 2015-11-23 04:30 +0100
  [PATCH v5 5/8] watchdog: Simplify update_worker Guenter Roeck <linux@roeck-us.net> - 2015-11-23 04:30 +0100
    Re: [PATCH v5 5/8] watchdog: Simplify update_worker Uwe Kleine-König   <u.kleine-koenig@pengutronix.de> - 2015-11-24 08:20 +0100
      Re: [PATCH v5 5/8] watchdog: Simplify update_worker Guenter Roeck <linux@roeck-us.net> - 2015-11-24 08:30 +0100
  [PATCH v5 2/8] watchdog: Introduce WDOG_RUNNING flag Guenter Roeck <linux@roeck-us.net> - 2015-11-23 04:30 +0100
    Re: [PATCH v5 2/8] watchdog: Introduce WDOG_RUNNING flag Alexander Stein <alexander.stein@systec-electronic.com> - 2015-11-23 17:40 +0100
      Re: [PATCH v5 2/8] watchdog: Introduce WDOG_RUNNING flag Guenter Roeck <linux@roeck-us.net> - 2015-11-23 17:50 +0100
    Re: [PATCH v5 2/8] watchdog: Introduce WDOG_RUNNING flag Uwe Kleine-König   <u.kleine-koenig@pengutronix.de> - 2015-11-23 20:30 +0100
      Re: [PATCH v5 2/8] watchdog: Introduce WDOG_RUNNING flag Guenter Roeck <linux@roeck-us.net> - 2015-11-23 22:50 +0100
  [RFT PATCH v5 8/8] watchdog: at91sam9: Convert to use infrastructure triggered keepalives Guenter Roeck <linux@roeck-us.net> - 2015-11-23 04:30 +0100
  [PATCH v5 4/8] watchdog: Add support for minimum time between heartbeats Guenter Roeck <linux@roeck-us.net> - 2015-11-23 04:30 +0100
  [PATCH v5 1/8] watchdog: Introduce hardware maximum timeout in watchdog core Guenter Roeck <linux@roeck-us.net> - 2015-11-23 04:30 +0100
    Re: [PATCH v5 1/8] watchdog: Introduce hardware maximum timeout in  watchdog core Uwe Kleine-König   <u.kleine-koenig@pengutronix.de> - 2015-11-23 09:00 +0100
      Re: [PATCH v5 1/8] watchdog: Introduce hardware maximum timeout in  watchdog core Guenter Roeck <linux@roeck-us.net> - 2015-11-23 17:20 +0100
        Re: [PATCH v5 1/8] watchdog: Introduce hardware maximum timeout in  watchdog core Uwe Kleine-König   <u.kleine-koenig@pengutronix.de> - 2015-11-23 19:30 +0100
          Re: [PATCH v5 1/8] watchdog: Introduce hardware maximum timeout in  watchdog core Guenter Roeck <linux@roeck-us.net> - 2015-11-23 23:00 +0100
    Re: [PATCH v5 1/8] watchdog: Introduce hardware maximum timeout in  watchdog core Uwe Kleine-König   <u.kleine-koenig@pengutronix.de> - 2015-11-24 08:20 +0100
      Re: [PATCH v5 1/8] watchdog: Introduce hardware maximum timeout in  watchdog core Guenter Roeck <linux@roeck-us.net> - 2015-11-24 16:10 +0100
        Re: [PATCH v5 1/8] watchdog: Introduce hardware maximum timeout in  watchdog core Uwe Kleine-König   <u.kleine-koenig@pengutronix.de> - 2015-11-24 17:20 +0100
          Re: [PATCH v5 1/8] watchdog: Introduce hardware maximum timeout in  watchdog core Guenter Roeck <linux@roeck-us.net> - 2015-11-24 17:50 +0100
            Re: [PATCH v5 1/8] watchdog: Introduce hardware maximum timeout in  watchdog core Uwe Kleine-König   <u.kleine-koenig@pengutronix.de> - 2015-11-24 22:20 +0100

csiph-web