summaryrefslogtreecommitdiff
path: root/drivers/watchdog/intel-mid_wdt.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/watchdog/intel-mid_wdt.c')
-rw-r--r--drivers/watchdog/intel-mid_wdt.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/drivers/watchdog/intel-mid_wdt.c b/drivers/watchdog/intel-mid_wdt.c
index db36d12e2b52..a4b729259b12 100644
--- a/drivers/watchdog/intel-mid_wdt.c
+++ b/drivers/watchdog/intel-mid_wdt.c
@@ -43,6 +43,7 @@ static inline int wdt_command(int sub, u32 *in, int inlen)
static int wdt_start(struct watchdog_device *wd)
{
+ struct device *dev = watchdog_get_drvdata(wd);
int ret, in_size;
int timeout = wd->timeout;
struct ipc_wd_start {
@@ -57,36 +58,32 @@ static int wdt_start(struct watchdog_device *wd)
in_size = DIV_ROUND_UP(sizeof(ipc_wd_start), 4);
ret = wdt_command(SCU_WATCHDOG_START, (u32 *)&ipc_wd_start, in_size);
- if (ret) {
- struct device *dev = watchdog_get_drvdata(wd);
+ if (ret)
dev_crit(dev, "error starting watchdog: %d\n", ret);
- }
return ret;
}
static int wdt_ping(struct watchdog_device *wd)
{
+ struct device *dev = watchdog_get_drvdata(wd);
int ret;
ret = wdt_command(SCU_WATCHDOG_KEEPALIVE, NULL, 0);
- if (ret) {
- struct device *dev = watchdog_get_drvdata(wd);
- dev_crit(dev, "Error executing keepalive: 0x%x\n", ret);
- }
+ if (ret)
+ dev_crit(dev, "Error executing keepalive: %d\n", ret);
return ret;
}
static int wdt_stop(struct watchdog_device *wd)
{
+ struct device *dev = watchdog_get_drvdata(wd);
int ret;
ret = wdt_command(SCU_WATCHDOG_STOP, NULL, 0);
- if (ret) {
- struct device *dev = watchdog_get_drvdata(wd);
- dev_crit(dev, "Error stopping watchdog: 0x%x\n", ret);
- }
+ if (ret)
+ dev_crit(dev, "Error stopping watchdog: %d\n", ret);
return ret;
}
@@ -151,6 +148,9 @@ static int mid_wdt_probe(struct platform_device *pdev)
return ret;
}
+ /* Make sure the watchdog is not running */
+ wdt_stop(wdt_dev);
+
ret = watchdog_register_device(wdt_dev);
if (ret) {
dev_err(&pdev->dev, "error registering watchdog device\n");