git: ccd31b464568 - main - linuxkpi: Define `pm_suspend_target_state` in <linux/suspend.h>

From: Jean-Sébastien Pédron <dumbbell_at_FreeBSD.org>
Date: Wed, 25 Jan 2023 22:15:14 UTC
The branch main has been updated by dumbbell (ports committer):

URL: https://cgit.FreeBSD.org/src/commit/?id=ccd31b464568ecf5907dbecf255edf0676124735

commit ccd31b464568ecf5907dbecf255edf0676124735
Author:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
AuthorDate: 2023-01-20 20:13:32 +0000
Commit:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
CommitDate: 2023-01-25 21:57:21 +0000

    linuxkpi: Define `pm_suspend_target_state` in <linux/suspend.h>
    
    It is set to `PM_SUSPEND_ON`.
    
    Reviewed by:    manu
    Approved by:    manu
    Differential Revision:  https://reviews.freebsd.org/D38161
---
 sys/compat/linuxkpi/common/include/linux/suspend.h | 7 +++++++
 sys/compat/linuxkpi/common/src/linux_acpi.c        | 3 +++
 2 files changed, 10 insertions(+)

diff --git a/sys/compat/linuxkpi/common/include/linux/suspend.h b/sys/compat/linuxkpi/common/include/linux/suspend.h
index 5c15b0619bd0..8458a6f6d4c5 100644
--- a/sys/compat/linuxkpi/common/include/linux/suspend.h
+++ b/sys/compat/linuxkpi/common/include/linux/suspend.h
@@ -3,6 +3,13 @@
 #ifndef _LINUXKPI_LINUX_SUSPEND_H_
 #define _LINUXKPI_LINUX_SUSPEND_H_
 
+typedef int suspend_state_t;
+
+extern suspend_state_t pm_suspend_target_state;
+
+#define	PM_SUSPEND_ON		0
+#define	PM_SUSPEND_TO_IDLE	1
+
 static inline int
 pm_suspend_via_firmware()
 {
diff --git a/sys/compat/linuxkpi/common/src/linux_acpi.c b/sys/compat/linuxkpi/common/src/linux_acpi.c
index 5eb60941abac..e092481ff979 100644
--- a/sys/compat/linuxkpi/common/src/linux_acpi.c
+++ b/sys/compat/linuxkpi/common/src/linux_acpi.c
@@ -40,6 +40,7 @@
 #include <dev/acpica/acpivar.h>
 
 #include <linux/notifier.h>
+#include <linux/suspend.h>
 
 #include <acpi/acpi_bus.h>
 #include <acpi/video.h>
@@ -58,6 +59,8 @@ _Static_assert(LINUX_ACPI_TAGS <= LINUX_NOTIFY_TAGS,
 
 #ifdef DEV_ACPI
 
+suspend_state_t pm_suspend_target_state = PM_SUSPEND_ON;
+
 static uint32_t linux_acpi_target_sleep_state = ACPI_STATE_S0;
 
 static eventhandler_tag resume_tag;