diff mbox series

[1/6] watchdog/hpwdt: Stop hpwdt on unregister.

Message ID 1558126783-4877-2-git-send-email-jerry.hoemann@hpe.com (mailing list archive)
State Accepted
Headers show
Series watchdog/hpwdt: cleanups and kdump accommodations | expand

Commit Message

Jerry Hoemann May 17, 2019, 8:59 p.m. UTC
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>
---
 drivers/watchdog/hpwdt.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Guenter Roeck June 6, 2019, 9:14 p.m. UTC | #1
On Fri, May 17, 2019 at 02:59:38PM -0600, Jerry Hoemann wrote:
> 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>

> ---
>  drivers/watchdog/hpwdt.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/watchdog/hpwdt.c b/drivers/watchdog/hpwdt.c
> index ef30c7e..8c49f13 100644
> --- a/drivers/watchdog/hpwdt.c
> +++ b/drivers/watchdog/hpwdt.c
> @@ -310,6 +310,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);
>  	if (watchdog_init_timeout(&hpwdt_dev, soft_margin, NULL))
>  		dev_warn(&dev->dev, "Invalid soft_margin: %d.\n", soft_margin);
> @@ -350,9 +351,6 @@ static int hpwdt_init_one(struct pci_dev *dev,
>  
>  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);
diff mbox series

Patch

diff --git a/drivers/watchdog/hpwdt.c b/drivers/watchdog/hpwdt.c
index ef30c7e..8c49f13 100644
--- a/drivers/watchdog/hpwdt.c
+++ b/drivers/watchdog/hpwdt.c
@@ -310,6 +310,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);
 	if (watchdog_init_timeout(&hpwdt_dev, soft_margin, NULL))
 		dev_warn(&dev->dev, "Invalid soft_margin: %d.\n", soft_margin);
@@ -350,9 +351,6 @@  static int hpwdt_init_one(struct pci_dev *dev,
 
 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);