[PATCH v4 13/19] power: reset: msm-poweroff: Use devm_register_sys_off_handler(RESTART)

Andrew Davis afd at ti.com
Mon Feb 12 08:28:25 PST 2024


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

Signed-off-by: Andrew Davis <afd at ti.com>
---
 drivers/power/reset/msm-poweroff.c | 19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/drivers/power/reset/msm-poweroff.c b/drivers/power/reset/msm-poweroff.c
index 3bf0ea06c4853..c7eb6dc8e90ae 100644
--- a/drivers/power/reset/msm-poweroff.c
+++ b/drivers/power/reset/msm-poweroff.c
@@ -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,
-- 
2.39.2




More information about the Linux-mediatek mailing list