watchdog: Add watchdog_active() routine

Some watchdog may need to check if watchdog is ACTIVE or not, for example in
their suspend/resume hooks.

This patch adds this routine and changes the core drivers to use it.

Signed-off-by: Viresh Kumar <[email protected]>
Signed-off-by: Wim Van Sebroeck <[email protected]>
This commit is contained in:
Viresh Kumar 2012-03-12 09:51:56 +05:30 • committed by Wim Van Sebroeck
commit 257f8c4aae
3 changed files with 10 additions and 4 deletions

View file

@ -91,7 +91,7 @@ static inline void wdt_reset(void)
static void wdt_timer_tick(unsigned long data)
{
if (time_before(jiffies, next_heartbeat) ||
(!test_bit(WDOG_ACTIVE, &wdt_dev.status))) {
(!watchdog_active(&wdt_dev))) {
wdt_reset();
mod_timer(&timer, jiffies + WDT_HEARTBEAT);
} else

View file

@ -61,7 +61,7 @@ static struct watchdog_device *wdd;
static int watchdog_ping(struct watchdog_device *wddev)
{
if (test_bit(WDOG_ACTIVE, &wddev->status)) {
if (watchdog_active(wddev)) {
if (wddev->ops->ping)
return wddev->ops->ping(wddev); /* ping the watchdog */
else
@ -83,7 +83,7 @@ static int watchdog_start(struct watchdog_device *wddev)
{
int err;
if (!test_bit(WDOG_ACTIVE, &wddev->status)) {
if (!watchdog_active(wddev)) {
err = wddev->ops->start(wddev);
if (err < 0)
return err;
@ -113,7 +113,7 @@ static int watchdog_stop(struct watchdog_device *wddev)
return err;
}
if (test_bit(WDOG_ACTIVE, &wddev->status)) {
if (watchdog_active(wddev)) {
err = wddev->ops->stop(wddev);
if (err < 0)
return err;