diff mbox series

[v1] PM: hibernate: Use kernel_can_power_off()

Message ID 20220617122402.151782-1-dmitry.osipenko@collabora.com
State Accepted
Commit 202773260023b56e868d09d13d3a417028f1ff5b
Headers show
Series [v1] PM: hibernate: Use kernel_can_power_off() | expand

Commit Message

Dmitry Osipenko June 17, 2022, 12:24 p.m. UTC
Use new kernel_can_power_off() API instead of legacy pm_power_off global
variable to fix regressed hibernation to disk where machine no longer
powers off when it should because ACPI power driver transitioned to the
new sys-off based API and it doesn't use pm_power_off anymore.

Fixes: 98f30d0ecf79 ("ACPI: power: Switch to sys-off handler API")
Tested-by: Ken Moffat <zarniwhoop@ntlworld.com>
Reported-by: Ken Moffat <zarniwhhop@ntlworld.com>
Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
---
 kernel/power/hibernate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Rafael J. Wysocki June 21, 2022, 7 p.m. UTC | #1
On Fri, Jun 17, 2022 at 2:24 PM Dmitry Osipenko
<dmitry.osipenko@collabora.com> wrote:
>
> Use new kernel_can_power_off() API instead of legacy pm_power_off global
> variable to fix regressed hibernation to disk where machine no longer
> powers off when it should because ACPI power driver transitioned to the
> new sys-off based API and it doesn't use pm_power_off anymore.
>
> Fixes: 98f30d0ecf79 ("ACPI: power: Switch to sys-off handler API")
> Tested-by: Ken Moffat <zarniwhoop@ntlworld.com>
> Reported-by: Ken Moffat <zarniwhhop@ntlworld.com>
> Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
> ---
>  kernel/power/hibernate.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
> index 20a66bf9f465..89c71fce225d 100644
> --- a/kernel/power/hibernate.c
> +++ b/kernel/power/hibernate.c
> @@ -665,7 +665,7 @@ static void power_down(void)
>                 hibernation_platform_enter();
>                 fallthrough;
>         case HIBERNATION_SHUTDOWN:
> -               if (pm_power_off)
> +               if (kernel_can_power_off())
>                         kernel_power_off();
>                 break;
>         }
> --

Applied as 5.19-rc material, thanks!
diff mbox series

Patch

diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
index 20a66bf9f465..89c71fce225d 100644
--- a/kernel/power/hibernate.c
+++ b/kernel/power/hibernate.c
@@ -665,7 +665,7 @@  static void power_down(void)
 		hibernation_platform_enter();
 		fallthrough;
 	case HIBERNATION_SHUTDOWN:
-		if (pm_power_off)
+		if (kernel_can_power_off())
 			kernel_power_off();
 		break;
 	}