watchdog/hpwdt: Stop hpwdt on unregister.
authorJerry Hoemann <jerry.hoemann@hpe.com>
Fri, 17 May 2019 20:59:38 +0000 (14:59 -0600)
committerWim Van Sebroeck <wim@linux-watchdog.org>
Mon, 8 Jul 2019 14:10:08 +0000 (16:10 +0200)
Have the WD core stop the watchdog on unregister instead of explicitly
calling hpwdt_stop() in hpwdt_exit().

Signed-off-by: Jerry Hoemann <jerry.hoemann@hpe.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
drivers/watchdog/hpwdt.c

index f7b5242b9c85664f0886ecf0af26d96467778783..b2cba8851cf200a24f8113bedf8e0ae2ee24d179 100644 (file)
@@ -306,6 +306,7 @@ static int hpwdt_init_one(struct pci_dev *dev,
        if (retval != 0)
                goto error_init_nmi_decoding;
 
+       watchdog_stop_on_unregister(&hpwdt_dev);
        watchdog_set_nowayout(&hpwdt_dev, nowayout);
        watchdog_init_timeout(&hpwdt_dev, soft_margin, NULL);
 
@@ -343,9 +344,6 @@ error_pci_iomap:
 
 static void hpwdt_exit(struct pci_dev *dev)
 {
-       if (!nowayout)
-               hpwdt_stop();
-
        watchdog_unregister_device(&hpwdt_dev);
        hpwdt_exit_nmi_decoding();
        pci_iounmap(dev, pci_mem_addr);