diff options
| -rw-r--r-- | drivers/watchdog/bcm47xx_wdt.c | 21 | ||||
| -rw-r--r-- | include/linux/bcm47xx_wdt.h | 1 |
2 files changed, 21 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 | ||
| 172 | static 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 | |||
| 172 | static struct watchdog_ops bcm47xx_wdt_soft_ops = { | 183 | static 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 | ||
| 238 | err_handler: | ||
| 239 | unregister_restart_handler(&wdt->restart_handler); | ||
| 221 | err_notifier: | 240 | err_notifier: |
| 222 | unregister_reboot_notifier(&wdt->notifier); | 241 | unregister_reboot_notifier(&wdt->notifier); |
| 223 | err_timer: | 242 | err_timer: |
diff --git a/include/linux/bcm47xx_wdt.h b/include/linux/bcm47xx_wdt.h index b708786d4cbf..5582c211f594 100644 --- a/include/linux/bcm47xx_wdt.h +++ b/include/linux/bcm47xx_wdt.h | |||
| @@ -16,6 +16,7 @@ struct bcm47xx_wdt { | |||
| 16 | 16 | ||
| 17 | struct watchdog_device wdd; | 17 | struct watchdog_device wdd; |
| 18 | struct notifier_block notifier; | 18 | struct notifier_block notifier; |
| 19 | struct notifier_block restart_handler; | ||
| 19 | 20 | ||
| 20 | struct timer_list soft_timer; | 21 | struct timer_list soft_timer; |
| 21 | atomic_t soft_ticks; | 22 | atomic_t soft_ticks; |
