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
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
{
int err;
- if (!test_bit(WDOG_ACTIVE, &wddev->status)) {
+ if (!watchdog_active(wddev)) {
err = wddev->ops->start(wddev);
if (err < 0)
return err;
return err;
}
- if (test_bit(WDOG_ACTIVE, &wddev->status)) {
+ if (watchdog_active(wddev)) {
err = wddev->ops->stop(wddev);
if (err < 0)
return err;
#define WATCHDOG_NOWAYOUT_INIT_STATUS 0
#endif
+/* Use the following function to check wether or not the watchdog is active */
+static inline bool watchdog_active(struct watchdog_device *wdd)
+{
+ return test_bit(WDOG_ACTIVE, &wdd->status);
+}
+
/* Use the following function to set the nowayout feature */
static inline void watchdog_set_nowayout(struct watchdog_device *wdd, bool nowayout)
{