diff mbox series

[v4,1/2] PM: suspend: Define pm_suspend_target_state

Message ID 20230502150435.423770-1-kai.heng.feng@canonical.com (mailing list archive)
State Mainlined, archived
Headers show
Series [v4,1/2] PM: suspend: Define pm_suspend_target_state | expand

Commit Message

Kai-Heng Feng May 2, 2023, 3:04 p.m. UTC
Define pm_suspend_target_state so it can still be used when
CONFIG_SUSPEND is not set.

Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
---
v4:
 - Move pm_suspend_target_state to CONFIG_SUSPEND block.

v3:
 - New patch to resolve undefined pm_suspend_target_state.

 drivers/base/power/wakeup.c | 5 -----
 include/linux/suspend.h     | 4 +++-
 2 files changed, 3 insertions(+), 6 deletions(-)

Comments

Rafael J. Wysocki May 24, 2023, 4:55 p.m. UTC | #1
On Tue, May 2, 2023 at 5:05 PM Kai-Heng Feng
<kai.heng.feng@canonical.com> wrote:
>
> Define pm_suspend_target_state so it can still be used when
> CONFIG_SUSPEND is not set.
>
> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
> ---
> v4:
>  - Move pm_suspend_target_state to CONFIG_SUSPEND block.
>
> v3:
>  - New patch to resolve undefined pm_suspend_target_state.
>
>  drivers/base/power/wakeup.c | 5 -----
>  include/linux/suspend.h     | 4 +++-
>  2 files changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c
> index 7cc0c0cf8eaa..a917219feea6 100644
> --- a/drivers/base/power/wakeup.c
> +++ b/drivers/base/power/wakeup.c
> @@ -19,11 +19,6 @@
>
>  #include "power.h"
>
> -#ifndef CONFIG_SUSPEND
> -suspend_state_t pm_suspend_target_state;
> -#define pm_suspend_target_state        (PM_SUSPEND_ON)
> -#endif
> -
>  #define list_for_each_entry_rcu_locked(pos, head, member) \
>         list_for_each_entry_rcu(pos, head, member, \
>                 srcu_read_lock_held(&wakeup_srcu))
> diff --git a/include/linux/suspend.h b/include/linux/suspend.h
> index d0d4598a7b3f..474ecfbbaa62 100644
> --- a/include/linux/suspend.h
> +++ b/include/linux/suspend.h
> @@ -202,6 +202,7 @@ struct platform_s2idle_ops {
>  };
>
>  #ifdef CONFIG_SUSPEND
> +extern suspend_state_t pm_suspend_target_state;
>  extern suspend_state_t mem_sleep_current;
>  extern suspend_state_t mem_sleep_default;
>
> @@ -337,6 +338,8 @@ extern bool sync_on_suspend_enabled;
>  #else /* !CONFIG_SUSPEND */
>  #define suspend_valid_only_mem NULL
>
> +#define pm_suspend_target_state        (PM_SUSPEND_ON)
> +
>  static inline void pm_suspend_clear_flags(void) {}
>  static inline void pm_set_suspend_via_firmware(void) {}
>  static inline void pm_set_resume_via_firmware(void) {}
> @@ -503,7 +506,6 @@ extern void pm_report_max_hw_sleep(u64 t);
>
>  /* drivers/base/power/wakeup.c */
>  extern bool events_check_enabled;
> -extern suspend_state_t pm_suspend_target_state;
>
>  extern bool pm_wakeup_pending(void);
>  extern void pm_system_wakeup(void);
> --

Applied as 6.5 material under an edited subject and with some edits in
the changelog.

Thanks!
diff mbox series

Patch

diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c
index 7cc0c0cf8eaa..a917219feea6 100644
--- a/drivers/base/power/wakeup.c
+++ b/drivers/base/power/wakeup.c
@@ -19,11 +19,6 @@ 
 
 #include "power.h"
 
-#ifndef CONFIG_SUSPEND
-suspend_state_t pm_suspend_target_state;
-#define pm_suspend_target_state	(PM_SUSPEND_ON)
-#endif
-
 #define list_for_each_entry_rcu_locked(pos, head, member) \
 	list_for_each_entry_rcu(pos, head, member, \
 		srcu_read_lock_held(&wakeup_srcu))
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index d0d4598a7b3f..474ecfbbaa62 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -202,6 +202,7 @@  struct platform_s2idle_ops {
 };
 
 #ifdef CONFIG_SUSPEND
+extern suspend_state_t pm_suspend_target_state;
 extern suspend_state_t mem_sleep_current;
 extern suspend_state_t mem_sleep_default;
 
@@ -337,6 +338,8 @@  extern bool sync_on_suspend_enabled;
 #else /* !CONFIG_SUSPEND */
 #define suspend_valid_only_mem	NULL
 
+#define pm_suspend_target_state	(PM_SUSPEND_ON)
+
 static inline void pm_suspend_clear_flags(void) {}
 static inline void pm_set_suspend_via_firmware(void) {}
 static inline void pm_set_resume_via_firmware(void) {}
@@ -503,7 +506,6 @@  extern void pm_report_max_hw_sleep(u64 t);
 
 /* drivers/base/power/wakeup.c */
 extern bool events_check_enabled;
-extern suspend_state_t pm_suspend_target_state;
 
 extern bool pm_wakeup_pending(void);
 extern void pm_system_wakeup(void);