Commit cb7efc02 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Wim Van Sebroeck

watchdog: WatchDog Timer Driver Core - use passed watchdog_device

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: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: default avatarWim Van Sebroeck <wim@iguana.be>
parent 9d037a77
...@@ -59,7 +59,7 @@ static struct watchdog_device *wdd; ...@@ -59,7 +59,7 @@ static struct watchdog_device *wdd;
static int watchdog_ping(struct watchdog_device *wddev) 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) if (wddev->ops->ping)
return wddev->ops->ping(wddev); /* ping the watchdog */ return wddev->ops->ping(wddev); /* ping the watchdog */
else else
...@@ -81,12 +81,12 @@ static int watchdog_start(struct watchdog_device *wddev) ...@@ -81,12 +81,12 @@ static int watchdog_start(struct watchdog_device *wddev)
{ {
int err; int err;
if (!test_bit(WDOG_ACTIVE, &wdd->status)) { if (!test_bit(WDOG_ACTIVE, &wddev->status)) {
err = wddev->ops->start(wddev); err = wddev->ops->start(wddev);
if (err < 0) if (err < 0)
return err; return err;
set_bit(WDOG_ACTIVE, &wdd->status); set_bit(WDOG_ACTIVE, &wddev->status);
} }
return 0; return 0;
} }
...@@ -105,18 +105,18 @@ static int watchdog_stop(struct watchdog_device *wddev) ...@@ -105,18 +105,18 @@ static int watchdog_stop(struct watchdog_device *wddev)
{ {
int err = -EBUSY; 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", pr_info("%s: nowayout prevents watchdog to be stopped!\n",
wdd->info->identity); wddev->info->identity);
return err; return err;
} }
if (test_bit(WDOG_ACTIVE, &wdd->status)) { if (test_bit(WDOG_ACTIVE, &wddev->status)) {
err = wddev->ops->stop(wddev); err = wddev->ops->stop(wddev);
if (err < 0) if (err < 0)
return err; return err;
clear_bit(WDOG_ACTIVE, &wdd->status); clear_bit(WDOG_ACTIVE, &wddev->status);
} }
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment