From: zhangqing <zhangqing@rock-chips.com>
Date: Mon, 4 May 2015 01:34:14 +0000 (+0800)
Subject: rk3288: pmic: ricoh619: modify ricoh619_device_shutdown to syscore_shutdown.
X-Git-Tag: firefly_0821_release~4207
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=f3a6eaaee40b6db5c0b7c7c0ce6ab0f242a8e6ef;p=firefly-linux-kernel-4.4.55.git

rk3288: pmic: ricoh619: modify ricoh619_device_shutdown to syscore_shutdown.

	ricoh619_device_shutdown is earlier than syscore_shutdown.
	So PMIC use syscore_shutdown is safer.

Signed-off-by: zhangqing <zhangqing@rock-chips.com>
---

diff --git a/drivers/mfd/ricoh619.c b/drivers/mfd/ricoh619.c
index 148cbbea84dc..c20f1aebd21a 100755
--- a/drivers/mfd/ricoh619.c
+++ b/drivers/mfd/ricoh619.c
@@ -44,6 +44,7 @@
 #include <linux/regulator/machine.h>
 #include <linux/regmap.h>
 #include <linux/delay.h>
+#include <linux/syscore_ops.h>
 
 struct ricoh619 *g_ricoh619;
 struct sleep_control_data {
@@ -396,7 +397,7 @@ out:
 }
 
 static struct i2c_client *ricoh619_i2c_client;
-static void ricoh619_device_shutdown(struct i2c_client *client)
+static void ricoh619_device_shutdown(void)
 {
 	int ret;
 	uint8_t val;
@@ -770,6 +771,10 @@ static struct ricoh619_platform_data *ricoh619_parse_dt(struct ricoh619 *ricoh61
 }
 #endif
 
+static struct syscore_ops ricoh619_syscore_ops = {
+	.shutdown = ricoh619_device_shutdown,
+};
+
 static void ricoh619_noe_init(struct ricoh619 *ricoh)
 {
 	int ret;
@@ -892,6 +897,7 @@ static int ricoh619_i2c_probe(struct i2c_client *client,
 	ricoh619_debuginit(ricoh619);
 
 	ricoh619_i2c_client = client;
+	register_syscore_ops(&ricoh619_syscore_ops);
 	return 0;
 err:
 	mfd_remove_devices(ricoh619->dev);
@@ -901,6 +907,8 @@ err:
 static int ricoh619_i2c_remove(struct i2c_client *client)
 {
 	struct ricoh619 *ricoh619 = i2c_get_clientdata(client);
+
+	unregister_syscore_ops(&ricoh619_syscore_ops);
 	ricoh619_remove_subdevs(ricoh619);
 	return 0;
 }
@@ -985,7 +993,6 @@ static struct i2c_driver ricoh619_i2c_driver = {
 		   },
 	.probe = ricoh619_i2c_probe,
 	.remove = ricoh619_i2c_remove,
-	.shutdown = ricoh619_device_shutdown,
 
 	.id_table = ricoh619_i2c_id,
 };