@@ -23,7 +23,7 @@
static struct device *sysctrl_dev;
-static void ab8500_power_off(void)
+static void ab8500_power_off(struct power_off_handler_block *this)
{
sigset_t old;
sigset_t all;
@@ -85,6 +85,11 @@ shutdown:
}
}
+static struct power_off_handler_block ab8500_power_off_hb = {
+ .handler = ab8500_power_off,
+ .priority = POWER_OFF_PRIORITY_LOW,
+};
+
/*
* Use the AB WD to reset the platform. It will perform a hard
* reset instead of a soft reset. Write the reset reason to
@@ -185,6 +190,7 @@ static int ab8500_sysctrl_probe(struct platform_device *pdev)
struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent);
struct ab8500_platform_data *plat;
struct ab8500_sysctrl_platform_data *pdata;
+ int err;
plat = dev_get_platdata(pdev->dev.parent);
@@ -193,8 +199,10 @@ static int ab8500_sysctrl_probe(struct platform_device *pdev)
sysctrl_dev = &pdev->dev;
- if (!pm_power_off)
- pm_power_off = ab8500_power_off;
+ err = devm_register_power_off_handler(sysctrl_dev,
+ &ab8500_power_off_hb);
+ if (err)
+ dev_warn(&pdev->dev, "Failed to register power-off handler\n");
pdata = plat->sysctrl;
if (pdata) {
@@ -228,9 +236,6 @@ static int ab8500_sysctrl_remove(struct platform_device *pdev)
{
sysctrl_dev = NULL;
- if (pm_power_off == ab8500_power_off)
- pm_power_off = NULL;
-
return 0;
}