Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1646956 > unrolled thread

[PATCH v5 1/3] watchdog: introduce watchdog_worker_should_ping helper

Started byRasmus Villemoes <rasmus.villemoes@prevas.dk>
First post2017-05-22 16:20 +0200
Last post2017-05-25 03:00 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v5 1/3] watchdog: introduce watchdog_worker_should_ping helper Rasmus Villemoes <rasmus.villemoes@prevas.dk> - 2017-05-22 16:20 +0200
    Re: [PATCH v5 1/3] watchdog: introduce watchdog_worker_should_ping  helper Guenter Roeck <linux@roeck-us.net> - 2017-05-25 03:00 +0200

#1646956 — [PATCH v5 1/3] watchdog: introduce watchdog_worker_should_ping helper

FromRasmus Villemoes <rasmus.villemoes@prevas.dk>
Date2017-05-22 16:20 +0200
Subject[PATCH v5 1/3] watchdog: introduce watchdog_worker_should_ping helper
Message-ID<tJWlH-6KH-1@gated-at.bofh.it>
This will be useful when the condition becomes slightly more
complicated in the next patch.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
---
 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);
 }
 
-- 
2.7.4

[toc] | [next] | [standalone]


#1650097 — Re: [PATCH v5 1/3] watchdog: introduce watchdog_worker_should_ping helper

FromGuenter Roeck <linux@roeck-us.net>
Date2017-05-25 03:00 +0200
SubjectRe: [PATCH v5 1/3] watchdog: introduce watchdog_worker_should_ping helper
Message-ID<tKPi9-14X-5@gated-at.bofh.it>
In reply to#1646956
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@prevas.dk>

Reviewed-by: Guenter Roeck <linux@roeck-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);
>   }
>   
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web