mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 0/1] watchdog/hpwdt: Support Suspend and Resume
@ 2024-02-14 16:49 Jerry Hoemann
  2024-02-14 16:49 ` [PATCH v2 1/1] " Jerry Hoemann
  0 siblings, 1 reply; 3+ messages in thread
From: Jerry Hoemann @ 2024-02-14 16:49 UTC (permalink / raw)
  To: linux; +Cc: wim, linux-watchdog, linux-kernel, Jerry Hoemann

Add suspend/resume support to hpwdt.

Changes from v1
---
1) dropped dev_dbg messages in suspend/resume.

2) switch from DEFINE_SIMPLE_DEV_PM_OPS  to LATE_SYSTEM_SLEEP_PM_OPS




Jerry Hoemann (1):
  watchdog/hpwdt: Support Suspend and Resume

 drivers/watchdog/hpwdt.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2 1/1] watchdog/hpwdt: Support Suspend and Resume
  2024-02-14 16:49 [PATCH v2 0/1] watchdog/hpwdt: Support Suspend and Resume Jerry Hoemann
@ 2024-02-14 16:49 ` Jerry Hoemann
  2024-02-14 16:55   ` Guenter Roeck
  0 siblings, 1 reply; 3+ messages in thread
From: Jerry Hoemann @ 2024-02-14 16:49 UTC (permalink / raw)
  To: linux; +Cc: wim, linux-watchdog, linux-kernel, Jerry Hoemann

Add call backs to support suspend and resume.

Signed-off-by: Jerry Hoemann <jerry.hoemann@hpe.com>
---
 drivers/watchdog/hpwdt.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/drivers/watchdog/hpwdt.c b/drivers/watchdog/hpwdt.c
index 138dc8d8ca3d..ae30e394d176 100644
--- a/drivers/watchdog/hpwdt.c
+++ b/drivers/watchdog/hpwdt.c
@@ -378,11 +378,36 @@ static void hpwdt_exit(struct pci_dev *dev)
 	pci_disable_device(dev);
 }
 
+static int hpwdt_suspend(struct device *dev)
+{
+	if (watchdog_active(&hpwdt_dev))
+		hpwdt_stop();
+
+	return 0;
+}
+
+static int hpwdt_resume(struct device *dev)
+{
+	if (watchdog_active(&hpwdt_dev))
+		hpwdt_start(&hpwdt_dev);
+
+	return 0;
+}
+
+static const struct dev_pm_ops hpwdt_pm_ops = {
+	LATE_SYSTEM_SLEEP_PM_OPS(hpwdt_suspend, hpwdt_resume)
+};
+
 static struct pci_driver hpwdt_driver = {
 	.name = "hpwdt",
 	.id_table = hpwdt_devices,
 	.probe = hpwdt_init_one,
 	.remove = hpwdt_exit,
+
+	.driver = {
+		.name = "hpwdt",
+		.pm = &hpwdt_pm_ops,
+	}
 };
 
 MODULE_AUTHOR("Tom Mingarelli");
-- 
2.43.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 1/1] watchdog/hpwdt: Support Suspend and Resume
  2024-02-14 16:49 ` [PATCH v2 1/1] " Jerry Hoemann
@ 2024-02-14 16:55   ` Guenter Roeck
  0 siblings, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2024-02-14 16:55 UTC (permalink / raw)
  To: Jerry Hoemann; +Cc: wim, linux-watchdog, linux-kernel

On 2/14/24 08:49, Jerry Hoemann wrote:
> Add call backs to support suspend and resume.
> 
> Signed-off-by: Jerry Hoemann <jerry.hoemann@hpe.com>

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

> ---
>   drivers/watchdog/hpwdt.c | 25 +++++++++++++++++++++++++
>   1 file changed, 25 insertions(+)
> 
> diff --git a/drivers/watchdog/hpwdt.c b/drivers/watchdog/hpwdt.c
> index 138dc8d8ca3d..ae30e394d176 100644
> --- a/drivers/watchdog/hpwdt.c
> +++ b/drivers/watchdog/hpwdt.c
> @@ -378,11 +378,36 @@ static void hpwdt_exit(struct pci_dev *dev)
>   	pci_disable_device(dev);
>   }
>   
> +static int hpwdt_suspend(struct device *dev)
> +{
> +	if (watchdog_active(&hpwdt_dev))
> +		hpwdt_stop();
> +
> +	return 0;
> +}
> +
> +static int hpwdt_resume(struct device *dev)
> +{
> +	if (watchdog_active(&hpwdt_dev))
> +		hpwdt_start(&hpwdt_dev);
> +
> +	return 0;
> +}
> +
> +static const struct dev_pm_ops hpwdt_pm_ops = {
> +	LATE_SYSTEM_SLEEP_PM_OPS(hpwdt_suspend, hpwdt_resume)
> +};
> +
>   static struct pci_driver hpwdt_driver = {
>   	.name = "hpwdt",
>   	.id_table = hpwdt_devices,
>   	.probe = hpwdt_init_one,
>   	.remove = hpwdt_exit,
> +
> +	.driver = {
> +		.name = "hpwdt",
> +		.pm = &hpwdt_pm_ops,
> +	}
>   };
>   
>   MODULE_AUTHOR("Tom Mingarelli");


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-02-14 16:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-14 16:49 [PATCH v2 0/1] watchdog/hpwdt: Support Suspend and Resume Jerry Hoemann
2024-02-14 16:49 ` [PATCH v2 1/1] " Jerry Hoemann
2024-02-14 16:55   ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®