diff options
author | Andrew Davis <afd@ti.com> | 2024-02-12 10:28:25 -0600 |
---|---|---|
committer | Sebastian Reichel <sebastian.reichel@collabora.com> | 2024-02-13 02:17:26 +0100 |
commit | 00ae86ebf893e0c89a7af6bfd270259e3ded93d1 (patch) | |
tree | 83065f08e6bb14401a085b8ce98e33288b81ceb6 | |
parent | b5711ff9171325261a7d6406b3c2b3c7752b6b8a (diff) | |
download | linux-00ae86ebf893e0c89a7af6bfd270259e3ded93d1.tar.gz linux-00ae86ebf893e0c89a7af6bfd270259e3ded93d1.tar.bz2 linux-00ae86ebf893e0c89a7af6bfd270259e3ded93d1.zip |
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>
-rw-r--r-- | drivers/power/reset/msm-poweroff.c | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/drivers/power/reset/msm-poweroff.c b/drivers/power/reset/msm-poweroff.c index 3bf0ea06c485..c7eb6dc8e90a 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, |