[PATCH 1/4] PM: hibernate: export pm_sleep_transition_in_progress()

Muhammad Usama Anjum posted 4 patches 1 month, 1 week ago
[PATCH 1/4] PM: hibernate: export pm_sleep_transition_in_progress()
Posted by Muhammad Usama Anjum 1 month, 1 week ago
Export pm_sleep_transition_in_progress() to be used by other
modules.

Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
---
 kernel/power/main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/power/main.c b/kernel/power/main.c
index 33a47ed15994f..ff3354b5be150 100644
--- a/kernel/power/main.c
+++ b/kernel/power/main.c
@@ -570,6 +570,7 @@ bool pm_sleep_transition_in_progress(void)
 {
 	return pm_suspend_in_progress() || hibernation_in_progress();
 }
+EXPORT_SYMBOL_GPL(pm_sleep_transition_in_progress);
 #endif /* CONFIG_PM_SLEEP */
 
 #ifdef CONFIG_PM_SLEEP_DEBUG
-- 
2.47.3
Re: [PATCH 1/4] PM: hibernate: export pm_sleep_transition_in_progress()
Posted by Greg Kroah-Hartman 3 weeks, 4 days ago
On Fri, Nov 07, 2025 at 11:44:28PM +0500, Muhammad Usama Anjum wrote:
> Export pm_sleep_transition_in_progress() to be used by other
> modules.
> 
> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
> ---
>  kernel/power/main.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/kernel/power/main.c b/kernel/power/main.c
> index 33a47ed15994f..ff3354b5be150 100644
> --- a/kernel/power/main.c
> +++ b/kernel/power/main.c
> @@ -570,6 +570,7 @@ bool pm_sleep_transition_in_progress(void)
>  {
>  	return pm_suspend_in_progress() || hibernation_in_progress();
>  }
> +EXPORT_SYMBOL_GPL(pm_sleep_transition_in_progress);

The problem is, you can not rely on the result of this call as it could
change right after you call it, right?

So who needs to call this and why?  What new workflow requires this?

thanks,

greg k-h
Re: [PATCH 1/4] PM: hibernate: export pm_sleep_transition_in_progress()
Posted by Muhammad Usama Anjum 3 weeks, 3 days ago
On 11/24/25 10:01 PM, Greg Kroah-Hartman wrote:
> On Fri, Nov 07, 2025 at 11:44:28PM +0500, Muhammad Usama Anjum wrote:
>> Export pm_sleep_transition_in_progress() to be used by other
>> modules.
>>
>> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
>> ---
>>  kernel/power/main.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/kernel/power/main.c b/kernel/power/main.c
>> index 33a47ed15994f..ff3354b5be150 100644
>> --- a/kernel/power/main.c
>> +++ b/kernel/power/main.c
>> @@ -570,6 +570,7 @@ bool pm_sleep_transition_in_progress(void)
>>  {
>>  	return pm_suspend_in_progress() || hibernation_in_progress();
>>  }
>> +EXPORT_SYMBOL_GPL(pm_sleep_transition_in_progress);
> 
> The problem is, you can not rely on the result of this call as it could
> change right after you call it, right?
> 
> So who needs to call this and why?  What new workflow requires this?
Yeah, Rafael just mentioned as well that this API isn't dependable. I need
to use better flag for detecting if driver is suspended. I'm testing if
suspended flag in ACPI button driver is enough and similar flag can be added
in input driver.

> 
> thanks,
> 
> greg k-h


-- 
---
Thanks,
Usama