@@ -23,11 +23,17 @@
#include <linux/pm.h>
static void __iomem *msm_ps_hold;
-static int do_msm_restart(struct notifier_block *nb, unsigned long action,
- void *data)
+
+static void _do_msm_restart(void)
{
writel(0, msm_ps_hold);
mdelay(10000);
+}
+
+static int do_msm_restart(struct notifier_block *nb, unsigned long action,
+ void *data)
+{
+ _do_msm_restart();
return NOTIFY_DONE;
}
@@ -37,12 +43,17 @@ static struct notifier_block restart_nb = {
.priority = 128,
};
-static void do_msm_poweroff(void)
+static void do_msm_power_off(struct power_off_handler_block *this)
{
- /* TODO: Add poweroff capability */
- do_msm_restart(&restart_nb, 0, NULL);
+ /* TODO: Add power-off capability */
+ _do_msm_restart();
}
+static struct power_off_handler_block power_off_hb = {
+ .handler = do_msm_power_off,
+ .priority = POWER_OFF_PRIORITY_FALLBACK,
+};
+
static int msm_restart_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
@@ -55,7 +66,8 @@ static int msm_restart_probe(struct platform_device *pdev)
register_restart_handler(&restart_nb);
- pm_power_off = do_msm_poweroff;
+ if (register_power_off_handler(&power_off_hb))
+ dev_warn(&pdev->dev, "Failed to register power-off handler\n");
return 0;
}