diff options
author | Damien Riegel <damien.riegel@savoirfairelinux.com> | 2015-11-16 12:28:03 -0500 |
---|---|---|
committer | Wim Van Sebroeck <wim@iguana.be> | 2015-12-13 09:29:30 -0500 |
commit | 0f10d9c57e56baaf90027bc8bda8ba9e033357e3 (patch) | |
tree | 6ee27e68ecd8b8b08659ffe0b7aed5d02f33de94 | |
parent | d3b081857cef5e25d53e5299a2816d1938dae553 (diff) |
watchdog: imgpdc_wdt: use core restart handler
Get rid of the custom restart handler by using the one provided by the
watchdog core.
Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
-rw-r--r-- | drivers/watchdog/imgpdc_wdt.c | 34 |
1 files changed, 12 insertions, 22 deletions
diff --git a/drivers/watchdog/imgpdc_wdt.c b/drivers/watchdog/imgpdc_wdt.c index 15ab07230960..3679f2e1922f 100644 --- a/drivers/watchdog/imgpdc_wdt.c +++ b/drivers/watchdog/imgpdc_wdt.c | |||
@@ -45,7 +45,6 @@ | |||
45 | #include <linux/log2.h> | 45 | #include <linux/log2.h> |
46 | #include <linux/module.h> | 46 | #include <linux/module.h> |
47 | #include <linux/platform_device.h> | 47 | #include <linux/platform_device.h> |
48 | #include <linux/reboot.h> | ||
49 | #include <linux/slab.h> | 48 | #include <linux/slab.h> |
50 | #include <linux/watchdog.h> | 49 | #include <linux/watchdog.h> |
51 | 50 | ||
@@ -87,7 +86,6 @@ struct pdc_wdt_dev { | |||
87 | struct clk *wdt_clk; | 86 | struct clk *wdt_clk; |
88 | struct clk *sys_clk; | 87 | struct clk *sys_clk; |
89 | void __iomem *base; | 88 | void __iomem *base; |
90 | struct notifier_block restart_handler; | ||
91 | }; | 89 | }; |
92 | 90 | ||
93 | static int pdc_wdt_keepalive(struct watchdog_device *wdt_dev) | 91 | static int pdc_wdt_keepalive(struct watchdog_device *wdt_dev) |
@@ -152,6 +150,16 @@ static int pdc_wdt_start(struct watchdog_device *wdt_dev) | |||
152 | return 0; | 150 | return 0; |
153 | } | 151 | } |
154 | 152 | ||
153 | static int pdc_wdt_restart(struct watchdog_device *wdt_dev) | ||
154 | { | ||
155 | struct pdc_wdt_dev *wdt = watchdog_get_drvdata(wdt_dev); | ||
156 | |||
157 | /* Assert SOFT_RESET */ | ||
158 | writel(0x1, wdt->base + PDC_WDT_SOFT_RESET); | ||
159 | |||
160 | return 0; | ||
161 | } | ||
162 | |||
155 | static struct watchdog_info pdc_wdt_info = { | 163 | static struct watchdog_info pdc_wdt_info = { |
156 | .identity = "IMG PDC Watchdog", | 164 | .identity = "IMG PDC Watchdog", |
157 | .options = WDIOF_SETTIMEOUT | | 165 | .options = WDIOF_SETTIMEOUT | |
@@ -165,20 +173,9 @@ static const struct watchdog_ops pdc_wdt_ops = { | |||
165 | .stop = pdc_wdt_stop, | 173 | .stop = pdc_wdt_stop, |
166 | .ping = pdc_wdt_keepalive, | 174 | .ping = pdc_wdt_keepalive, |
167 | .set_timeout = pdc_wdt_set_timeout, | 175 | .set_timeout = pdc_wdt_set_timeout, |
176 | .restart = pdc_wdt_restart, | ||
168 | }; | 177 | }; |
169 | 178 | ||
170 | static int pdc_wdt_restart(struct notifier_block *this, unsigned long mode, | ||
171 | void *cmd) | ||
172 | { | ||
173 | struct pdc_wdt_dev *wdt = container_of(this, struct pdc_wdt_dev, | ||
174 | restart_handler); | ||
175 | |||
176 | /* Assert SOFT_RESET */ | ||
177 | writel(0x1, wdt->base + PDC_WDT_SOFT_RESET); | ||
178 | |||
179 | return NOTIFY_OK; | ||
180 | } | ||
181 | |||
182 | static int pdc_wdt_probe(struct platform_device *pdev) | 179 | static int pdc_wdt_probe(struct platform_device *pdev) |
183 | { | 180 | { |
184 | u64 div; | 181 | u64 div; |
@@ -282,6 +279,7 @@ static int pdc_wdt_probe(struct platform_device *pdev) | |||
282 | } | 279 | } |
283 | 280 | ||
284 | watchdog_set_nowayout(&pdc_wdt->wdt_dev, nowayout); | 281 | watchdog_set_nowayout(&pdc_wdt->wdt_dev, nowayout); |
282 | watchdog_set_restart_priority(&pdc_wdt->wdt_dev, 128); | ||
285 | 283 | ||
286 | platform_set_drvdata(pdev, pdc_wdt); | 284 | platform_set_drvdata(pdev, pdc_wdt); |
287 | 285 | ||
@@ -289,13 +287,6 @@ static int pdc_wdt_probe(struct platform_device *pdev) | |||
289 | if (ret) | 287 | if (ret) |
290 | goto disable_wdt_clk; | 288 | goto disable_wdt_clk; |
291 | 289 | ||
292 | pdc_wdt->restart_handler.notifier_call = pdc_wdt_restart; | ||
293 | pdc_wdt->restart_handler.priority = 128; | ||
294 | ret = register_restart_handler(&pdc_wdt->restart_handler); | ||
295 | if (ret) | ||
296 | dev_warn(&pdev->dev, "failed to register restart handler: %d\n", | ||
297 | ret); | ||
298 | |||
299 | return 0; | 290 | return 0; |
300 | 291 | ||
301 | disable_wdt_clk: | 292 | disable_wdt_clk: |
@@ -316,7 +307,6 @@ static int pdc_wdt_remove(struct platform_device *pdev) | |||
316 | { | 307 | { |
317 | struct pdc_wdt_dev *pdc_wdt = platform_get_drvdata(pdev); | 308 | struct pdc_wdt_dev *pdc_wdt = platform_get_drvdata(pdev); |
318 | 309 | ||
319 | unregister_restart_handler(&pdc_wdt->restart_handler); | ||
320 | pdc_wdt_stop(&pdc_wdt->wdt_dev); | 310 | pdc_wdt_stop(&pdc_wdt->wdt_dev); |
321 | watchdog_unregister_device(&pdc_wdt->wdt_dev); | 311 | watchdog_unregister_device(&pdc_wdt->wdt_dev); |
322 | clk_disable_unprepare(pdc_wdt->wdt_clk); | 312 | clk_disable_unprepare(pdc_wdt->wdt_clk); |