Skip to content

Commit

Permalink
watchdog: WatchDog Timer Driver Core - use passed watchdog_device
Browse files Browse the repository at this point in the history
Use the passed watchdog_device instead of the static global variable when
testing and setting the status in watchdog_ping, watchdog_start, and
watchdog_stop.  Note that the callers of these functions are actually
passing the static global variable.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
  • Loading branch information
H Hartley Sweeten authored and Wim Van Sebroeck committed Sep 20, 2011
1 parent 9d037a7 commit cb7efc0
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions drivers/watchdog/watchdog_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ static struct watchdog_device *wdd;

static int watchdog_ping(struct watchdog_device *wddev)
{
if (test_bit(WDOG_ACTIVE, &wdd->status)) {
if (test_bit(WDOG_ACTIVE, &wddev->status)) {
if (wddev->ops->ping)
return wddev->ops->ping(wddev); /* ping the watchdog */
else
Expand All @@ -81,12 +81,12 @@ static int watchdog_start(struct watchdog_device *wddev)
{
int err;

if (!test_bit(WDOG_ACTIVE, &wdd->status)) {
if (!test_bit(WDOG_ACTIVE, &wddev->status)) {
err = wddev->ops->start(wddev);
if (err < 0)
return err;

set_bit(WDOG_ACTIVE, &wdd->status);
set_bit(WDOG_ACTIVE, &wddev->status);
}
return 0;
}
Expand All @@ -105,18 +105,18 @@ static int watchdog_stop(struct watchdog_device *wddev)
{
int err = -EBUSY;

if (test_bit(WDOG_NO_WAY_OUT, &wdd->status)) {
if (test_bit(WDOG_NO_WAY_OUT, &wddev->status)) {
pr_info("%s: nowayout prevents watchdog to be stopped!\n",
wdd->info->identity);
wddev->info->identity);
return err;
}

if (test_bit(WDOG_ACTIVE, &wdd->status)) {
if (test_bit(WDOG_ACTIVE, &wddev->status)) {
err = wddev->ops->stop(wddev);
if (err < 0)
return err;

clear_bit(WDOG_ACTIVE, &wdd->status);
clear_bit(WDOG_ACTIVE, &wddev->status);
}
return 0;
}
Expand Down

0 comments on commit cb7efc0

Please sign in to comment.