kernel/reboot: Fix powering off using a non-syscall code paths
authorDmitry Osipenko <dmitry.osipenko@collabora.com>
Mon, 6 Jun 2022 16:56:40 +0000 (19:56 +0300)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 7 Jun 2022 17:42:31 +0000 (19:42 +0200)
commit2b8c612c6102f751e6e3e1bd425f64e9d3d3f638
tree4aec7da25b81670ec25d70e1b102932b0348de07
parent587b9bfe0668bc997e51af9526a0c7c084d4660f
kernel/reboot: Fix powering off using a non-syscall code paths

There are other methods of powering off machine than the reboot syscall.
Previously we missed to cover those methods and it created power-off
regression for some machines, like the PowerPC e500.

Fix this problem by moving the legacy sys-off handler registration to
the latest phase of power-off process and making the kernel_can_power_off()
check the legacy pm_power_off presence.

Tested-by: Michael Ellerman <mpe@ellerman.id.au> # ppce500
Reported-by: Michael Ellerman <mpe@ellerman.id.au> # ppce500
Fixes: da007f171fc9 ("kernel/reboot: Change registration order of legacy power-off handler")
Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
kernel/reboot.c