diff options
Diffstat (limited to 'drivers/power/reset/vexpress-poweroff.c')
-rw-r--r-- | drivers/power/reset/vexpress-poweroff.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/power/reset/vexpress-poweroff.c b/drivers/power/reset/vexpress-poweroff.c index 476aa495c110..b95cf71ed695 100644 --- a/drivers/power/reset/vexpress-poweroff.c +++ b/drivers/power/reset/vexpress-poweroff.c | |||
@@ -11,7 +11,7 @@ | |||
11 | * Copyright (C) 2012 ARM Limited | 11 | * Copyright (C) 2012 ARM Limited |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/jiffies.h> | 14 | #include <linux/delay.h> |
15 | #include <linux/of.h> | 15 | #include <linux/of.h> |
16 | #include <linux/of_device.h> | 16 | #include <linux/of_device.h> |
17 | #include <linux/platform_device.h> | 17 | #include <linux/platform_device.h> |
@@ -23,17 +23,12 @@ | |||
23 | static void vexpress_reset_do(struct device *dev, const char *what) | 23 | static void vexpress_reset_do(struct device *dev, const char *what) |
24 | { | 24 | { |
25 | int err = -ENOENT; | 25 | int err = -ENOENT; |
26 | struct vexpress_config_func *func = | 26 | struct vexpress_config_func *func = dev_get_drvdata(dev); |
27 | vexpress_config_func_get_by_dev(dev); | ||
28 | 27 | ||
29 | if (func) { | 28 | if (func) { |
30 | unsigned long timeout; | ||
31 | |||
32 | err = vexpress_config_write(func, 0, 0); | 29 | err = vexpress_config_write(func, 0, 0); |
33 | 30 | if (!err) | |
34 | timeout = jiffies + HZ; | 31 | mdelay(1000); |
35 | while (time_before(jiffies, timeout)) | ||
36 | cpu_relax(); | ||
37 | } | 32 | } |
38 | 33 | ||
39 | dev_emerg(dev, "Unable to %s (%d)\n", what, err); | 34 | dev_emerg(dev, "Unable to %s (%d)\n", what, err); |
@@ -96,12 +91,18 @@ static int vexpress_reset_probe(struct platform_device *pdev) | |||
96 | enum vexpress_reset_func func; | 91 | enum vexpress_reset_func func; |
97 | const struct of_device_id *match = | 92 | const struct of_device_id *match = |
98 | of_match_device(vexpress_reset_of_match, &pdev->dev); | 93 | of_match_device(vexpress_reset_of_match, &pdev->dev); |
94 | struct vexpress_config_func *config_func; | ||
99 | 95 | ||
100 | if (match) | 96 | if (match) |
101 | func = (enum vexpress_reset_func)match->data; | 97 | func = (enum vexpress_reset_func)match->data; |
102 | else | 98 | else |
103 | func = pdev->id_entry->driver_data; | 99 | func = pdev->id_entry->driver_data; |
104 | 100 | ||
101 | config_func = vexpress_config_func_get_by_dev(&pdev->dev); | ||
102 | if (!config_func) | ||
103 | return -EINVAL; | ||
104 | dev_set_drvdata(&pdev->dev, config_func); | ||
105 | |||
105 | switch (func) { | 106 | switch (func) { |
106 | case FUNC_SHUTDOWN: | 107 | case FUNC_SHUTDOWN: |
107 | vexpress_power_off_device = &pdev->dev; | 108 | vexpress_power_off_device = &pdev->dev; |