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


Groups > linux.kernel > #1650097

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

Path csiph.com!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod
From Guenter Roeck <linux@roeck-us.net>
Newsgroups linux.kernel
Subject Re: [PATCH v5 1/3] watchdog: introduce watchdog_worker_should_ping helper
Date Thu, 25 May 2017 03:00:01 +0200
Message-ID <tKPi9-14X-5@gated-at.bofh.it> (permalink)
References <tJWlH-6KH-3@gated-at.bofh.it> <tJWlH-6KH-1@gated-at.bofh.it>
X-Original-To Rasmus Villemoes <rasmus.villemoes@prevas.dk>, Wim Van Sebroeck <wim@iguana.be>
Dkim-Signature v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=roeck-us.net; s=default; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=qhRQiIFOWvujLSQtJH3+F4CkcSBlZow+eRrRix0fnPQ=; b=fNV8qPOmj6OR8UmIMAGPC0Ifbd 40noCKDOkJ8VYjfgFfSHiBiCJ2lYvWDAOYUu1jbrHknZrnPzXD20Fk7fce95+JF20yztydqXsDk1H EsEsjg87d32dI2ctU+XXOj8z16GkJsZtmU567+697xu9nP4fFhCjUqlUa208InpEcvFiT+/0ZdBuf DqCdxslgmwXu4M6dQ4WZZRgjZJubEgopE5C4zaCKtZQFfr2MOiM332a79eyOZUB5Auxy+Znyq2Vkm ow6YhzCTKgUMG82BceBDNoQ7q/WuIvBmWNFnfZtiveSvt6LzIOUZt7C23Dsbmb2kedENKqn0HwfEk zBHymjsw==;
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1
MIME-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Language en-US
Content-Transfer-Encoding 7bit
X-Authenticated_Sender linux@roeck-us.net
X-Outgoing-Spam-Status No, score=-1.0
X-Antiabuse This header was added to track abuse, please include it with any abuse report
X-Antiabuse Primary Hostname - bh-25.webhostbox.net
X-Antiabuse Original Domain - vger.kernel.org
X-Antiabuse Originator/Caller UID/GID - [47 12] / [47 12]
X-Antiabuse Sender Address Domain - roeck-us.net
X-Get-Message-Sender-Via bh-25.webhostbox.net: authenticated_id: linux@roeck-us.net
X-Authenticated-Sender bh-25.webhostbox.net: linux@roeck-us.net
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 45
Organization linux.* mail to news gateway
X-Original-Cc Sebastian Reichel <sebastian.reichel@collabora.co.uk>, esben.haabendal@gmail.com, linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org
X-Original-Date Wed, 24 May 2017 17:53:21 -0700
X-Original-Message-ID <2360adb8-ad7b-9b9f-d83c-db994dec00c9@roeck-us.net>
X-Original-References <1495462000-28979-1-git-send-email-rasmus.villemoes@prevas.dk> <1495462000-28979-2-git-send-email-rasmus.villemoes@prevas.dk>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1650097

Show key headers only | View raw


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);
>   }
>   
> 

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[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

csiph-web