From 8a7a83c87351bd852fb24c6b3ba92e7a76a655ba Mon Sep 17 00:00:00 2001
From: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Date: Tue, 2 Nov 2021 15:24:12 +0300
Subject: [PATCH] powerpc/fsl: Use sys-off handler

Replace restart handler with sys-off handler. Restart handler might become
deprecated once all users are switched to sys-off handler, this allows to
removes some boilerplate code and provides more features.

Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
---
 arch/powerpc/sysdev/fsl_soc.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index 90ad161616043..ffa7f962ac856 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -155,23 +155,19 @@ EXPORT_SYMBOL(get_baudrate);
 #if defined(CONFIG_FSL_SOC_BOOKE) || defined(CONFIG_PPC_86xx)
 static __be32 __iomem *rstcr;
 
-static int fsl_rstcr_restart(struct notifier_block *this,
-			     unsigned long mode, void *cmd)
+static void fsl_rstcr_restart(struct restart_data *data)
 {
 	local_irq_disable();
 	/* set reset control register */
 	out_be32(rstcr, 0x2);	/* HRESET_REQ */
-
-	return NOTIFY_DONE;
 }
 
 static int __init setup_rstcr(void)
 {
 	struct device_node *np;
 
-	static struct notifier_block restart_handler = {
-		.notifier_call = fsl_rstcr_restart,
-		.priority = 128,
+	static struct sys_off_handler restart_handler = {
+		.restart_cb = fsl_rstcr_restart,
 	};
 
 	for_each_node_by_name(np, "global-utilities") {
@@ -181,7 +177,7 @@ static int __init setup_rstcr(void)
 				printk (KERN_ERR "Error: reset control "
 						"register not mapped!\n");
 			} else {
-				register_restart_handler(&restart_handler);
+				register_sys_off_handler(&restart_handler);
 			}
 			break;
 		}
-- 
GitLab