Message ID | 20240423081723.412237-1-xiongxin@kylinos.cn |
---|---|
State | New |
Headers | show |
Series | PM: sleep: Optimize the pm_debug_messages_should_print() function | expand |
diff --git a/kernel/power/main.c b/kernel/power/main.c index a9e0693aaf69..24693599c0bc 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c @@ -613,7 +613,7 @@ bool pm_debug_messages_on __read_mostly; bool pm_debug_messages_should_print(void) { - return pm_debug_messages_on && pm_suspend_target_state != PM_SUSPEND_ON; + return pm_debug_messages_on; } EXPORT_SYMBOL_GPL(pm_debug_messages_should_print);
commit cdb8c100d8a4 ("include/linux/suspend.h: Only show pm_pr_dbg messages at suspend/resume"), pm_debug_messages_should_print() is implemented to determine the output of pm_pr_dbg(), using pm_suspend_target_state to identify the suspend process. However, this limits the output range of pm_pr_dbg(). In the suspend process, pm_pr_dbg() is called before setting pm_suspend_target_state. As a result, this part of the log cannot be output. pm_pr_dbg() also outputs debug logs for hibernate, but pm_suspend_target_state is not set, resulting in hibernate debug logs can only be output through dynamic debug, which is very inconvenient. Currently, remove pm_suspend_target_state from pm_debug_messages_should_print() to ensure that sleep and hibernate main logic can output debug normally. Fixes: cdb8c100d8a4 ("include/linux/suspend.h: Only show pm_pr_dbg messages at suspend/resume"). Signed-off-by: xiongxin <xiongxin@kylinos.cn> --- v2: * Resolve the compilation error and re-submit with the fix patch. v1: * Revert the commit cdb8c100d8a4 ("include/linux/suspend.h: Only show pm_pr_dbg messages at suspend/resume"). ---