summaryrefslogtreecommitdiffstats
path: root/drivers/watchdog
diff options
context:
space:
mode:
authorDamien Riegel <damien.riegel@savoirfairelinux.com>2015-11-16 12:28:08 -0500
committerWim Van Sebroeck <wim@iguana.be>2015-12-13 15:29:51 +0100
commite86adc3f631bd9d773f1028d6d88c9f5a02b07a5 (patch)
tree8b3f991d2b8e7ec88356341a2b8e6329a94ed701 /drivers/watchdog
parent46c17f0f91729404b3578570302db88039fee8b5 (diff)
downloadlinux-e86adc3f631bd9d773f1028d6d88c9f5a02b07a5.tar.bz2
watchdog: mtk_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>
Diffstat (limited to 'drivers/watchdog')
-rw-r--r--drivers/watchdog/mtk_wdt.c22
1 files changed, 5 insertions, 17 deletions
diff --git a/drivers/watchdog/mtk_wdt.c b/drivers/watchdog/mtk_wdt.c
index b751f43d76ed..b78776c05554 100644
--- a/drivers/watchdog/mtk_wdt.c
+++ b/drivers/watchdog/mtk_wdt.c
@@ -28,8 +28,6 @@
#include <linux/platform_device.h>
#include <linux/types.h>
#include <linux/watchdog.h>
-#include <linux/notifier.h>
-#include <linux/reboot.h>
#include <linux/delay.h>
#define WDT_MAX_TIMEOUT 31
@@ -64,16 +62,13 @@ static unsigned int timeout = WDT_MAX_TIMEOUT;
struct mtk_wdt_dev {
struct watchdog_device wdt_dev;
void __iomem *wdt_base;
- struct notifier_block restart_handler;
};
-static int mtk_reset_handler(struct notifier_block *this, unsigned long mode,
- void *cmd)
+static int mtk_wdt_restart(struct watchdog_device *wdt_dev)
{
- struct mtk_wdt_dev *mtk_wdt;
+ struct mtk_wdt_dev *mtk_wdt = watchdog_get_drvdata(wdt_dev);
void __iomem *wdt_base;
- mtk_wdt = container_of(this, struct mtk_wdt_dev, restart_handler);
wdt_base = mtk_wdt->wdt_base;
while (1) {
@@ -81,7 +76,7 @@ static int mtk_reset_handler(struct notifier_block *this, unsigned long mode,
mdelay(5);
}
- return NOTIFY_DONE;
+ return 0;
}
static int mtk_wdt_ping(struct watchdog_device *wdt_dev)
@@ -161,6 +156,7 @@ static const struct watchdog_ops mtk_wdt_ops = {
.stop = mtk_wdt_stop,
.ping = mtk_wdt_ping,
.set_timeout = mtk_wdt_set_timeout,
+ .restart = mtk_wdt_restart,
};
static int mtk_wdt_probe(struct platform_device *pdev)
@@ -189,6 +185,7 @@ static int mtk_wdt_probe(struct platform_device *pdev)
watchdog_init_timeout(&mtk_wdt->wdt_dev, timeout, &pdev->dev);
watchdog_set_nowayout(&mtk_wdt->wdt_dev, nowayout);
+ watchdog_set_restart_priority(&mtk_wdt->wdt_dev, 128);
watchdog_set_drvdata(&mtk_wdt->wdt_dev, mtk_wdt);
@@ -198,13 +195,6 @@ static int mtk_wdt_probe(struct platform_device *pdev)
if (unlikely(err))
return err;
- mtk_wdt->restart_handler.notifier_call = mtk_reset_handler;
- mtk_wdt->restart_handler.priority = 128;
- err = register_restart_handler(&mtk_wdt->restart_handler);
- if (err)
- dev_warn(&pdev->dev,
- "cannot register restart handler (err=%d)\n", err);
-
dev_info(&pdev->dev, "Watchdog enabled (timeout=%d sec, nowayout=%d)\n",
mtk_wdt->wdt_dev.timeout, nowayout);
@@ -223,8 +213,6 @@ static int mtk_wdt_remove(struct platform_device *pdev)
{
struct mtk_wdt_dev *mtk_wdt = platform_get_drvdata(pdev);
- unregister_restart_handler(&mtk_wdt->restart_handler);
-
watchdog_unregister_device(&mtk_wdt->wdt_dev);
return 0;