[RFC 3/3] PM / hibernate: Wire up system-power framework

From: Thierry Reding
Date: Mon Jan 30 2017 - 12:21:47 EST


From: Thierry Reding <treding@xxxxxxxxxx>

Use the system-power framework's equivalent to test for power off
capability instead of relying on the globally defined pm_power_off()
function pointer.

The system-power framework implements a fallback that relies on this
global function in case no system power chips have been registered.

Moving this to the system-power framework allows us to eventually
remove any traces of pm_power_off() once all handlers have moved over
to the new framework.

Signed-off-by: Thierry Reding <treding@xxxxxxxxxx>
---
kernel/power/hibernate.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
index b26dbc48c75b..e7429ea11e9a 100644
--- a/kernel/power/hibernate.c
+++ b/kernel/power/hibernate.c
@@ -30,6 +30,7 @@
#include <linux/genhd.h>
#include <linux/ktime.h>
#include <trace/events/power.h>
+#include <linux/system-power.h>

#include "power.h"

@@ -617,7 +618,7 @@ static void power_down(void)
case HIBERNATION_PLATFORM:
hibernation_platform_enter();
case HIBERNATION_SHUTDOWN:
- if (pm_power_off)
+ if (system_can_power_off())
kernel_power_off();
break;
#ifdef CONFIG_SUSPEND
--
2.11.0