From 486b69b43c47d85a0f292dca127f0b9063443a54 Mon Sep 17 00:00:00 2001
From: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Date: Tue, 2 Nov 2021 14:49:40 +0300
Subject: [PATCH] powerpc/83xx: Use register_platform_power_off()

Utilize new register_platform_power_off() API that allows to register
multiple power-off handlers and deprecates global pm_power_off callback.

Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
---
 arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c b/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c
index a38372f9ac12c..504dbec110e42 100644
--- a/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c
+++ b/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c
@@ -163,10 +163,9 @@ static int mcu_probe(struct i2c_client *client)
 	if (ret)
 		goto err;
 
-	/* XXX: this is potentially racy, but there is no lock for pm_power_off */
-	if (!pm_power_off) {
+	if (!glob_mcu) {
 		glob_mcu = mcu;
-		pm_power_off = mcu_power_off;
+		register_platform_power_off(mcu_power_off);
 		dev_info(&client->dev, "will provide power-off service\n");
 	}
 
@@ -192,7 +191,7 @@ static int mcu_remove(struct i2c_client *client)
 	device_remove_file(&client->dev, &dev_attr_status);
 
 	if (glob_mcu == mcu) {
-		pm_power_off = NULL;
+		unregister_platform_power_off(mcu_power_off);
 		glob_mcu = NULL;
 	}
 
-- 
GitLab