[RFCv1 6/8] mfd: rk808: use common syscore for all PMCI for clean shutdown

Anand Moon
2019-12-06T18:46:43Z

Move the register_syscore_ops to common location for all PMIC.
Add missing unregister_syscore_ops in rk808_remove function.

Cc: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Anand Moon <linux.amoon@gmail.com>
---
drivers/mfd/rk808.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c
index 9a7be379946a..54f3999e4948 100644
--- a/drivers/mfd/rk808.c
+++ b/drivers/mfd/rk808.c
@@ -590,7 +590,6 @@ static int rk808_probe(struct i2c_client *client,
nr_pre_init_regs = ARRAY_SIZE(rk817_pre_init_reg);
cells = rk817s;
nr_cells = ARRAY_SIZE(rk817s);
- register_syscore_ops(&rk808_syscore_ops);
break;
default:
dev_err(&client->dev, "Unsupported RK8XX ID %lu\n",
@@ -644,6 +643,8 @@ static int rk808_probe(struct i2c_client *client,
if (!rk808_i2c_client)
rk808_i2c_client = client;

+ register_syscore_ops(&rk808_syscore_ops);
+
return 0;

err_irq:
@@ -657,6 +658,8 @@ static int rk808_remove(struct i2c_client *client)

regmap_del_irq_chip(client->irq, rk808->irq_data);

+ unregister_syscore_ops(&rk808_syscore_ops);
+
return 0;
}

--
2.24.0