aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/ab8500-sysctrl.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mfd/ab8500-sysctrl.c')
-rw-r--r--drivers/mfd/ab8500-sysctrl.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/mfd/ab8500-sysctrl.c b/drivers/mfd/ab8500-sysctrl.c
index fbca1ced49fa..8e0dae59844d 100644
--- a/drivers/mfd/ab8500-sysctrl.c
+++ b/drivers/mfd/ab8500-sysctrl.c
@@ -23,7 +23,7 @@
23 23
24static struct device *sysctrl_dev; 24static struct device *sysctrl_dev;
25 25
26void ab8500_power_off(void) 26static void ab8500_power_off(void)
27{ 27{
28 sigset_t old; 28 sigset_t old;
29 sigset_t all; 29 sigset_t all;
@@ -104,7 +104,7 @@ void ab8500_restart(char mode, const char *cmd)
104 104
105 plat = dev_get_platdata(sysctrl_dev->parent); 105 plat = dev_get_platdata(sysctrl_dev->parent);
106 pdata = plat->sysctrl; 106 pdata = plat->sysctrl;
107 if (pdata->reboot_reason_code) 107 if (pdata && pdata->reboot_reason_code)
108 reason = pdata->reboot_reason_code(cmd); 108 reason = pdata->reboot_reason_code(cmd);
109 else 109 else
110 pr_warn("[%s] No reboot reason set. Default reason %d\n", 110 pr_warn("[%s] No reboot reason set. Default reason %d\n",
@@ -188,14 +188,15 @@ static int ab8500_sysctrl_probe(struct platform_device *pdev)
188 188
189 plat = dev_get_platdata(pdev->dev.parent); 189 plat = dev_get_platdata(pdev->dev.parent);
190 190
191 if (!(plat && plat->sysctrl)) 191 if (!plat)
192 return -EINVAL; 192 return -EINVAL;
193 193
194 if (plat->pm_power_off) 194 sysctrl_dev = &pdev->dev;
195
196 if (!pm_power_off)
195 pm_power_off = ab8500_power_off; 197 pm_power_off = ab8500_power_off;
196 198
197 pdata = plat->sysctrl; 199 pdata = plat->sysctrl;
198
199 if (pdata) { 200 if (pdata) {
200 int last, ret, i, j; 201 int last, ret, i, j;
201 202
@@ -226,6 +227,10 @@ static int ab8500_sysctrl_probe(struct platform_device *pdev)
226static int ab8500_sysctrl_remove(struct platform_device *pdev) 227static int ab8500_sysctrl_remove(struct platform_device *pdev)
227{ 228{
228 sysctrl_dev = NULL; 229 sysctrl_dev = NULL;
230
231 if (pm_power_off == ab8500_power_off)
232 pm_power_off = NULL;
233
229 return 0; 234 return 0;
230} 235}
231 236