Commit c013b65a authored by Rasmus Villemoes's avatar Rasmus Villemoes Committed by Wim Van Sebroeck

watchdog: introduce watchdog_worker_should_ping helper

This will be useful when the condition becomes slightly more
complicated in the next patch.
Signed-off-by: default avatarRasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: default avatarEsben Haabendal <esben@haabendal.dk>
Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarWim Van Sebroeck <wim@iguana.be>
parent e7bf0289
...@@ -195,18 +195,23 @@ static int watchdog_ping(struct watchdog_device *wdd) ...@@ -195,18 +195,23 @@ static int watchdog_ping(struct watchdog_device *wdd)
return __watchdog_ping(wdd); return __watchdog_ping(wdd);
} }
static bool watchdog_worker_should_ping(struct watchdog_core_data *wd_data)
{
struct watchdog_device *wdd = wd_data->wdd;
return wdd && (watchdog_active(wdd) || watchdog_hw_running(wdd));
}
static void watchdog_ping_work(struct work_struct *work) static void watchdog_ping_work(struct work_struct *work)
{ {
struct watchdog_core_data *wd_data; struct watchdog_core_data *wd_data;
struct watchdog_device *wdd;
wd_data = container_of(to_delayed_work(work), struct watchdog_core_data, wd_data = container_of(to_delayed_work(work), struct watchdog_core_data,
work); work);
mutex_lock(&wd_data->lock); mutex_lock(&wd_data->lock);
wdd = wd_data->wdd; if (watchdog_worker_should_ping(wd_data))
if (wdd && (watchdog_active(wdd) || watchdog_hw_running(wdd))) __watchdog_ping(wd_data->wdd);
__watchdog_ping(wdd);
mutex_unlock(&wd_data->lock); mutex_unlock(&wd_data->lock);
} }
......
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