power: reset: msm-poweroff: Use devm_register_sys_off_handler(RESTART)

Use device life-cycle managed register function to simplify probe.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240212162831.67838-14-afd@ti.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
This commit is contained in:
Andrew Davis
2024-02-12 10:28:25 -06:00
committed by Sebastian Reichel
parent b5711ff917
commit 00ae86ebf8

View File

@@ -14,23 +14,11 @@
#include <linux/pm.h>
static void __iomem *msm_ps_hold;
static int deassert_pshold(struct notifier_block *nb, unsigned long action,
void *data)
{
writel(0, msm_ps_hold);
mdelay(10000);
return NOTIFY_DONE;
}
static struct notifier_block restart_nb = {
.notifier_call = deassert_pshold,
.priority = 128,
};
static int do_msm_poweroff(struct sys_off_data *data)
{
deassert_pshold(&restart_nb, 0, NULL);
writel(0, msm_ps_hold);
mdelay(10000);
return NOTIFY_DONE;
}
@@ -41,7 +29,8 @@ static int msm_restart_probe(struct platform_device *pdev)
if (IS_ERR(msm_ps_hold))
return PTR_ERR(msm_ps_hold);
register_restart_handler(&restart_nb);
devm_register_sys_off_handler(&pdev->dev, SYS_OFF_MODE_RESTART,
128, do_msm_poweroff, NULL);
devm_register_sys_off_handler(&pdev->dev, SYS_OFF_MODE_POWER_OFF,
SYS_OFF_PRIO_DEFAULT, do_msm_poweroff,