diff --git a/drivers/watchdog/msc313e_wdt.c b/drivers/watchdog/msc313e_wdt.c index c7d558fefc86..e28261c7a8d4 100644 --- a/drivers/watchdog/msc313e_wdt.c +++ b/drivers/watchdog/msc313e_wdt.c @@ -31,6 +31,16 @@ struct msc313e_wdt_priv { struct clk *clk; }; +static u32 msc313e_wdt_get_hw_timeout(struct msc313e_wdt_priv *priv) +{ + u16 low, high; + + low = readw(priv->base + REG_WDT_MAX_PRD_L); + high = readw(priv->base + REG_WDT_MAX_PRD_H); + + return ((u32)high << 16) | low; +} + static void msc313e_wdt_set_hw_timeout(struct msc313e_wdt_priv *priv, unsigned int timeout) { @@ -139,7 +149,7 @@ static int msc313e_wdt_probe(struct platform_device *pdev) return ret; /* If the period is non-zero the WDT is running */ - if (readw(priv->base + REG_WDT_MAX_PRD_L) | (readw(priv->base + REG_WDT_MAX_PRD_H) << 16)) { + if (msc313e_wdt_get_hw_timeout(priv)) { set_bit(WDOG_HW_RUNNING, &priv->wdev.status); /* * Keep the clock enabled. The watchdog core will skip the next