Received: by 10.223.176.46 with SMTP id f43csp945878wra; Sat, 20 Jan 2018 07:47:00 -0800 (PST) X-Google-Smtp-Source: AH8x224AZq9G2iGbjtZnBrpfb3dBi1YDYOE18lLiCOg2p8H/fFNBMlTOHeIctHjN91HuUb3urFtN X-Received: by 10.98.55.3 with SMTP id e3mr2804919pfa.119.1516463220105; Sat, 20 Jan 2018 07:47:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516463220; cv=none; d=google.com; s=arc-20160816; b=ec/LAUXgMyljAM+HdaOXIPE/H8ge/dzl00hJ4vJKgXTgAwICrG2Ss+qtldMLoW8CgM NiqkNdGGu6ELDEnMgMyST6ULRTQA/jm7pL1dE5dnrTNmGi5P9+V7MTUQHmBBGGzTXpgR R28ebF9MXXLPK+dJL9KxoLsd2gv4TrTkupkIKOPmLdnNLd6DyUMlTIG1wKSiHcnW94MJ OD567bBLcyexV6/AzQy0yn/gkiIOIDmfLdi9Mi4FwDy8X0IgrQj5YGyuCE3Fo2MiXuPs /Co3iqg50aKCqvGyoNfX6rspqVgDsCIJ90HD4bP8wqkOAtfQs0KibHSptI7yYZ6XVNIV qEBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=YC+uA4ZvdZbYDESjHE9cjPDvWzqU72tKrLK+BYrQ9es=; b=TkIatmhwMzXuLu3ftA0bJbOzSK0JFWdNr00Q36qign6ayDRVa9XWS6cSYLDSKbcgxN w5UYpyfQ2dm1VuXofEo6d5khwqaoVuTj/QL73fcR4DdGqmLekrYR/jpRQoJvNZD6PhX9 DbdkJ17JYcxNn9aVURwd71Jqm6y++c/kn/2Lg/JvZIH/77rCOg7F776GLOdyED+ChNTM eXBTri6FSS1FZeN13+EVVFtti85CF+dPE9a+u0VYL5L7qZYrUzViIfuIuKyVqIDWufSH q9SrH/zKD6UPp8FSXnC7E+0qqjd5Lcg3gbU/ms7M5/SEwDj762MGW7std4pnUugmHcUS oCiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=LWezTObn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a12si5957712pgq.440.2018.01.20.07.46.46; Sat, 20 Jan 2018 07:47:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=LWezTObn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756422AbeATPp5 (ORCPT + 99 others); Sat, 20 Jan 2018 10:45:57 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:36043 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756334AbeATPpu (ORCPT ); Sat, 20 Jan 2018 10:45:50 -0500 Received: by mail-pf0-f193.google.com with SMTP id 23so3689486pfp.3; Sat, 20 Jan 2018 07:45:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=YC+uA4ZvdZbYDESjHE9cjPDvWzqU72tKrLK+BYrQ9es=; b=LWezTObnCPNvh6B0KTBsPazicrBiHNAsDU3lBcqwzjp/LQ+JkhvT2W61rFcOMiKPe3 lWv8o2I9MkVxppOhWaYh/jQWp6LR0TxR5IIfOIkjBmLyL/ScAojzIFBWreK1ogMgevTY Ajqe6MLnYT9arBrEsvMe6Wrh1GrPytA21Ncczw8tNJrsZ7puHfSzp53f8Ws46+05ZlJq S5wVRjDL1GrzDGPh9RxxULdPo6aa40woAcvfPW/m2KbVYS9bSS4mmOq0O0JIsBtkwnYK +inVdpwsbYgzn43mEWUpAWDG2r7r56bzT9HEMLM/ScbeRuC9vDSTB2tg0bCwlJNH1g4j f6wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=YC+uA4ZvdZbYDESjHE9cjPDvWzqU72tKrLK+BYrQ9es=; b=rzHV/FT1NP3nzUdBJr/Qy/mw4qswKYSMZVCOferl0VqawZrog729s9NCPt9cyy3qRh Nkqg680LGKMFgxLHumEQ7BRVCBdPegw0US1RvcXAj4ZausHRWh87UQ75CEGDKVuNIseb jD+VSuQO432JP1aTisdcLgP1Pi3km9HvzLXQn/jM9U1i80RxTdO4+XrGoyqIVIYuVMsM Vs5J3uAdfOk4Vf0gV8i/8gxJKE9lhoAssVckUtBaYztCj8v3y7q//qhvLdiNlXATh7W/ lWVqWIbnIwVoUfTwIrR/sp+RqKkKpDLtZHEW77NYro+ZHaH+gk1LwZWwywtHmUe+CTIK lSHw== X-Gm-Message-State: AKwxytcZkgebWqnk3lSSjAUL0XEeiW4hIj8mOypo3bkcN/jgy4iVt/zX eFKXe84q0zMnMxbZvORR4K79cA== X-Received: by 10.99.116.82 with SMTP id e18mr2344872pgn.3.1516463149797; Sat, 20 Jan 2018 07:45:49 -0800 (PST) Received: from server.roeck-us.net (108-223-40-66.lightspeed.sntcca.sbcglobal.net. [108.223.40.66]) by smtp.gmail.com with ESMTPSA id b6sm18417544pgc.2.2018.01.20.07.45.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 20 Jan 2018 07:45:48 -0800 (PST) Subject: Re: [PATCH v2 3/8] watchdog: JZ4740: Register a restart handler To: PrasannaKumar Muralidharan , Paul Cercueil Cc: Ralf Baechle , Rob Herring , Mark Rutland , Wim Van Sebroeck , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Linux-MIPS , open list , linux-watchdog@vger.kernel.org References: <20171228162939.3928-2-paul@crapouillou.net> <20171230135108.6834-1-paul@crapouillou.net> <20171230135108.6834-3-paul@crapouillou.net> From: Guenter Roeck Message-ID: <20061de8-fa1f-93eb-eb9b-089c699018aa@roeck-us.net> Date: Sat, 20 Jan 2018 07:45:46 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/19/2018 11:31 PM, PrasannaKumar Muralidharan wrote: > Hi Paul, > > On 30 December 2017 at 19:21, Paul Cercueil wrote: >> The watchdog driver can restart the system by simply configuring the >> hardware for a timeout of 0 seconds. >> >> Signed-off-by: Paul Cercueil >> Reviewed-by: Guenter Roeck >> --- >> drivers/watchdog/jz4740_wdt.c | 9 +++++++++ >> 1 file changed, 9 insertions(+) >> >> v2: No change >> >> diff --git a/drivers/watchdog/jz4740_wdt.c b/drivers/watchdog/jz4740_wdt.c >> index 92d6ca8ceb49..fa7f49a3212c 100644 >> --- a/drivers/watchdog/jz4740_wdt.c >> +++ b/drivers/watchdog/jz4740_wdt.c >> @@ -130,6 +130,14 @@ static int jz4740_wdt_stop(struct watchdog_device *wdt_dev) >> return 0; >> } >> >> +static int jz4740_wdt_restart(struct watchdog_device *wdt_dev, >> + unsigned long action, void *data) >> +{ >> + wdt_dev->timeout = 0; >> + jz4740_wdt_start(wdt_dev); >> + return 0; >> +} >> + >> static const struct watchdog_info jz4740_wdt_info = { >> .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, >> .identity = "jz4740 Watchdog", >> @@ -141,6 +149,7 @@ static const struct watchdog_ops jz4740_wdt_ops = { >> .stop = jz4740_wdt_stop, >> .ping = jz4740_wdt_ping, >> .set_timeout = jz4740_wdt_set_timeout, >> + .restart = jz4740_wdt_restart, >> }; >> >> #ifdef CONFIG_OF >> -- >> 2.11.0 >> >> > > Noticed that min_timeout of the watchdog device is set to 1 but this > function calls start with timeout set to 0. Even though this works I > feel it is better to set min_timeout to 0. > No. That would be wrong. If you want to be pedantic, write a new function __jz4740_wdt_set_timeout(u16 clock_div, u16 timeout_value) and call it instead, but don't mess with min_timeout. Guenter