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


Groups > linux.kernel > #1663040 > unrolled thread

[PATCH 4/5] watchdog: it87: Use infrastructure to stop watchdog on reboot

Started byGuenter Roeck <linux@roeck-us.net>
First post2017-06-11 06:10 +0200
Last post2017-06-11 06:10 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 4/5] watchdog: it87: Use infrastructure to stop watchdog on reboot Guenter Roeck <linux@roeck-us.net> - 2017-06-11 06:10 +0200

#1663040 — [PATCH 4/5] watchdog: it87: Use infrastructure to stop watchdog on reboot

FromGuenter Roeck <linux@roeck-us.net>
Date2017-06-11 06:10 +0200
Subject[PATCH 4/5] watchdog: it87: Use infrastructure to stop watchdog on reboot
Message-ID<tR2ml-ja-13@gated-at.bofh.it>
Use watchdog_stop_on_reboot() to stop the watchdog on reboot instead
of registering a driver-specific notifier.

While at it, reorder remaining include files alphabetically.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 drivers/watchdog/it87_wdt.c | 34 +++++-----------------------------
 1 file changed, 5 insertions(+), 29 deletions(-)

diff --git a/drivers/watchdog/it87_wdt.c b/drivers/watchdog/it87_wdt.c
index 29aea28628c8..07f4727eb7f4 100644
--- a/drivers/watchdog/it87_wdt.c
+++ b/drivers/watchdog/it87_wdt.c
@@ -28,15 +28,13 @@
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
+#include <linux/init.h>
+#include <linux/io.h>
+#include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/types.h>
-#include <linux/kernel.h>
-#include <linux/init.h>
 #include <linux/watchdog.h>
-#include <linux/notifier.h>
-#include <linux/reboot.h>
-#include <linux/io.h>
 
 #define WATCHDOG_NAME		"IT87 WDT"
 
@@ -260,18 +258,6 @@ static struct watchdog_device wdt_dev = {
 	.min_timeout = 1,
 };
 
-static int wdt_notify_sys(struct notifier_block *this, unsigned long code,
-			  void *unused)
-{
-	if (code == SYS_DOWN || code == SYS_HALT)
-		wdt_stop(&wdt_dev);
-	return NOTIFY_DONE;
-}
-
-static struct notifier_block wdt_notifier = {
-	.notifier_call = wdt_notify_sys,
-};
-
 static int __init it87_wdt_init(void)
 {
 	u8  chip_rev;
@@ -338,32 +324,22 @@ static int __init it87_wdt_init(void)
 	wdt_dev.timeout = timeout;
 	wdt_dev.max_timeout = max_units * 60;
 
-	rc = register_reboot_notifier(&wdt_notifier);
-	if (rc) {
-		pr_err("Cannot register reboot notifier (err=%d)\n", rc);
-		return rc;
-	}
-
+	watchdog_stop_on_reboot(&wdt_dev);
 	rc = watchdog_register_device(&wdt_dev);
 	if (rc) {
 		pr_err("Cannot register watchdog device (err=%d)\n", rc);
-		goto err_out_reboot;
+		return rc;
 	}
 
 	pr_info("Chip IT%04x revision %d initialized. timeout=%d sec (nowayout=%d testmode=%d)\n",
 		chip_type, chip_rev, timeout, nowayout, testmode);
 
 	return 0;
-
-err_out_reboot:
-	unregister_reboot_notifier(&wdt_notifier);
-	return rc;
 }
 
 static void __exit it87_wdt_exit(void)
 {
 	watchdog_unregister_device(&wdt_dev);
-	unregister_reboot_notifier(&wdt_notifier);
 }
 
 module_init(it87_wdt_init);
-- 
2.7.4

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web