aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/watchdog
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2015-01-25 05:40:57 -0500
committerWim Van Sebroeck <wim@iguana.be>2015-02-17 15:33:27 -0500
commit1cc7495c60879eeeda52385a70c99c4cbaace7ef (patch)
tree2cba15b6cfc6e2607f0fbdd0f52242222eb56cb5 /drivers/watchdog
parentba804a9510df555c42c2be6c340960879afe39d2 (diff)
watchdog: bcm47xx_wdt.c: add restart handler support
Just like in case of other watchdog drivers, use the new kernel core API to provide restart support. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Diffstat (limited to 'drivers/watchdog')
-rw-r--r--drivers/watchdog/bcm47xx_wdt.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/drivers/watchdog/bcm47xx_wdt.c b/drivers/watchdog/bcm47xx_wdt.c
index 9816485f6825..b28a072abf78 100644
--- a/drivers/watchdog/bcm47xx_wdt.c
+++ b/drivers/watchdog/bcm47xx_wdt.c
@@ -169,6 +169,17 @@ static int bcm47xx_wdt_notify_sys(struct notifier_block *this,
169 return NOTIFY_DONE; 169 return NOTIFY_DONE;
170} 170}
171 171
172static int bcm47xx_wdt_restart(struct notifier_block *this, unsigned long mode,
173 void *cmd)
174{
175 struct bcm47xx_wdt *wdt;
176
177 wdt = container_of(this, struct bcm47xx_wdt, restart_handler);
178 wdt->timer_set(wdt, 1);
179
180 return NOTIFY_DONE;
181}
182
172static struct watchdog_ops bcm47xx_wdt_soft_ops = { 183static struct watchdog_ops bcm47xx_wdt_soft_ops = {
173 .owner = THIS_MODULE, 184 .owner = THIS_MODULE,
174 .start = bcm47xx_wdt_soft_start, 185 .start = bcm47xx_wdt_soft_start,
@@ -209,15 +220,23 @@ static int bcm47xx_wdt_probe(struct platform_device *pdev)
209 if (ret) 220 if (ret)
210 goto err_timer; 221 goto err_timer;
211 222
212 ret = watchdog_register_device(&wdt->wdd); 223 wdt->restart_handler.notifier_call = &bcm47xx_wdt_restart;
224 wdt->restart_handler.priority = 64;
225 ret = register_restart_handler(&wdt->restart_handler);
213 if (ret) 226 if (ret)
214 goto err_notifier; 227 goto err_notifier;
215 228
229 ret = watchdog_register_device(&wdt->wdd);
230 if (ret)
231 goto err_handler;
232
216 dev_info(&pdev->dev, "BCM47xx Watchdog Timer enabled (%d seconds%s%s)\n", 233 dev_info(&pdev->dev, "BCM47xx Watchdog Timer enabled (%d seconds%s%s)\n",
217 timeout, nowayout ? ", nowayout" : "", 234 timeout, nowayout ? ", nowayout" : "",
218 soft ? ", Software Timer" : ""); 235 soft ? ", Software Timer" : "");
219 return 0; 236 return 0;
220 237
238err_handler:
239 unregister_restart_handler(&wdt->restart_handler);
221err_notifier: 240err_notifier:
222 unregister_reboot_notifier(&wdt->notifier); 241 unregister_reboot_notifier(&wdt->notifier);
223err_timer: 242err_timer: