[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2360adb8-ad7b-9b9f-d83c-db994dec00c9@roeck-us.net>
Date: Wed, 24 May 2017 17:53:21 -0700
From: Guenter Roeck <linux@...ck-us.net>
To: Rasmus Villemoes <rasmus.villemoes@...vas.dk>,
Wim Van Sebroeck <wim@...ana.be>
Cc: Sebastian Reichel <sebastian.reichel@...labora.co.uk>,
esben.haabendal@...il.com, linux-watchdog@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v5 1/3] watchdog: introduce watchdog_worker_should_ping
helper
On 05/22/2017 07:06 AM, Rasmus Villemoes wrote:
> This will be useful when the condition becomes slightly more
> complicated in the next patch.
>
> Signed-off-by: Rasmus Villemoes <rasmus.villemoes@...vas.dk>
Reviewed-by: Guenter Roeck <linux@...ck-us.net>
> ---
> drivers/watchdog/watchdog_dev.c | 13 +++++++++----
> 1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c
> index d5d2bbd..caa4b90 100644
> --- a/drivers/watchdog/watchdog_dev.c
> +++ b/drivers/watchdog/watchdog_dev.c
> @@ -192,18 +192,23 @@ static int watchdog_ping(struct watchdog_device *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)
> {
> struct watchdog_core_data *wd_data;
> - struct watchdog_device *wdd;
>
> wd_data = container_of(to_delayed_work(work), struct watchdog_core_data,
> work);
>
> mutex_lock(&wd_data->lock);
> - wdd = wd_data->wdd;
> - if (wdd && (watchdog_active(wdd) || watchdog_hw_running(wdd)))
> - __watchdog_ping(wdd);
> + if (watchdog_worker_should_ping(wd_data))
> + __watchdog_ping(wd_data->wdd);
> mutex_unlock(&wd_data->lock);
> }
>
>
Powered by blists - more mailing lists