All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Jerry Hoemann <jerry.hoemann@hpe.com>
Cc: wim@linux-watchdog.org, linux-watchdog@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] watchdog/hpwdt: Support Suspend and Resume
Date: Tue, 13 Feb 2024 08:12:57 -0800	[thread overview]
Message-ID: <7b70a8e7-10ce-4835-891c-b854919fa3cb@roeck-us.net> (raw)
In-Reply-To: <20240213070203.489846-1-jerry.hoemann@hpe.com>

On Tue, Feb 13, 2024 at 12:02:03AM -0700, Jerry Hoemann wrote:
> Add call backs to support suspend and resume.
> 

That makes me wonder if we should add something like
	watchdog_stop_on_suspend()
to the watchdog core. Almost every watchdog driver supporting
suspend/resume repeats the same sequence (except for the debug
message). That is a separate question, though.

> Signed-off-by: Jerry Hoemann <jerry.hoemann@hpe.com>
> ---
>  drivers/watchdog/hpwdt.c | 27 +++++++++++++++++++++++++++
>  1 file changed, 27 insertions(+)
> 
> diff --git a/drivers/watchdog/hpwdt.c b/drivers/watchdog/hpwdt.c
> index 138dc8d8ca3d..6565cfaa8e57 100644
> --- a/drivers/watchdog/hpwdt.c
> +++ b/drivers/watchdog/hpwdt.c
> @@ -378,11 +378,38 @@ static void hpwdt_exit(struct pci_dev *dev)
>  	pci_disable_device(dev);
>  }
>  
> +static int hpwdt_suspend(struct device *dev)
> +{
> +	dev_dbg(dev, "Suspend watchdog\n");
> +

Doesn't the suspend / resume code already display such debug messages ?

> +	if (watchdog_active(&hpwdt_dev))
> +		hpwdt_stop();
> +
> +	return 0;
> +}
> +
> +static int hpwdt_resume(struct device *dev)
> +{
> +	dev_dbg(dev, "Resume watchdog\n");
> +
> +	if (watchdog_active(&hpwdt_dev))
> +		hpwdt_start(&hpwdt_dev);
> +
> +	return 0;
> +}
> +
> +static DEFINE_SIMPLE_DEV_PM_OPS(hpwdt_pm_ops, hpwdt_suspend, hpwdt_resume);

That disables / enables the watchdog as part of regular suspend/resume
handling, meaning any hang during suspend/resume that happens later will
hang the system. Sure you don't want to use SET_LATE_SYSTEM_SLEEP_PM_OPS()
instead ?

Never mind, though. Your call, obviously.

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

Thanks,
Guenter

  reply	other threads:[~2024-02-13 16:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-13  7:02 [PATCH] watchdog/hpwdt: Support Suspend and Resume Jerry Hoemann
2024-02-13 16:12 ` Guenter Roeck [this message]
2024-02-14  3:15   ` Jerry Hoemann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7b70a8e7-10ce-4835-891c-b854919fa3cb@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=jerry.hoemann@hpe.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=wim@linux-watchdog.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.