From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161596AbdAEO0G (ORCPT ); Thu, 5 Jan 2017 09:26:06 -0500 Received: from bh-25.webhostbox.net ([208.91.199.152]:48317 "EHLO bh-25.webhostbox.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161580AbdAEOZz (ORCPT ); Thu, 5 Jan 2017 09:25:55 -0500 Subject: Re: [PATCH 4/4] watchdog: tangox: Use watchdog core to install restart handler To: Marc Gonzalez , Mans Rullgard References: <1483565318-25578-1-git-send-email-linux@roeck-us.net> <1483565318-25578-4-git-send-email-linux@roeck-us.net> Cc: Wim Van Sebroeck , linux-watchdog@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org From: Guenter Roeck Message-ID: Date: Thu, 5 Jan 2017 06:25:50 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed 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 X-Source: X-Source-Args: X-Source-Dir: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/05/2017 01:42 AM, Marc Gonzalez wrote: > [ Adding Mans ] > > Guenter, patch c7ef68c32265 states "Fixes: a3e376d26ace". > Is that true? I mean, they seem quite orthogonal; then again I know > nothing of this framework. > max_hw_heartbeat_ms must be set for WDOG_HW_RUNNING to work. Guenter > Regards. > > On 04/01/2017 22:28, Guenter Roeck wrote: >> Use the infrastructure provided by the watchdog core to install >> the restart handler. >> >> Signed-off-by: Guenter Roeck >> --- >> drivers/watchdog/tangox_wdt.c | 32 +++++++++++--------------------- >> 1 file changed, 11 insertions(+), 21 deletions(-) >> >> diff --git a/drivers/watchdog/tangox_wdt.c b/drivers/watchdog/tangox_wdt.c >> index 202c4b9cc921..49e6e805db7c 100644 >> --- a/drivers/watchdog/tangox_wdt.c >> +++ b/drivers/watchdog/tangox_wdt.c >> @@ -15,9 +15,7 @@ >> #include >> #include >> #include >> -#include >> #include >> -#include >> #include >> >> #define DEFAULT_TIMEOUT 30 >> @@ -47,7 +45,6 @@ struct tangox_wdt_device { >> void __iomem *base; >> unsigned long clk_rate; >> struct clk *clk; >> - struct notifier_block restart; >> }; >> >> static int tangox_wdt_set_timeout(struct watchdog_device *wdt, >> @@ -96,24 +93,24 @@ static const struct watchdog_info tangox_wdt_info = { >> .identity = "tangox watchdog", >> }; >> >> +static int tangox_wdt_restart(struct watchdog_device *wdt, >> + unsigned long action, void *data) >> +{ >> + struct tangox_wdt_device *dev = watchdog_get_drvdata(wdt); >> + >> + writel(1, dev->base + WD_COUNTER); >> + >> + return 0; >> +} >> + >> static const struct watchdog_ops tangox_wdt_ops = { >> .start = tangox_wdt_start, >> .stop = tangox_wdt_stop, >> .set_timeout = tangox_wdt_set_timeout, >> .get_timeleft = tangox_wdt_get_timeleft, >> + .restart = tangox_wdt_restart, >> }; >> >> -static int tangox_wdt_restart(struct notifier_block *nb, unsigned long action, >> - void *data) >> -{ >> - struct tangox_wdt_device *dev = >> - container_of(nb, struct tangox_wdt_device, restart); >> - >> - writel(1, dev->base + WD_COUNTER); >> - >> - return NOTIFY_DONE; >> -} >> - >> static int tangox_wdt_probe(struct platform_device *pdev) >> { >> struct tangox_wdt_device *dev; >> @@ -180,12 +177,6 @@ static int tangox_wdt_probe(struct platform_device *pdev) >> >> platform_set_drvdata(pdev, dev); >> >> - dev->restart.notifier_call = tangox_wdt_restart; >> - dev->restart.priority = 128; >> - err = register_restart_handler(&dev->restart); >> - if (err) >> - dev_warn(&pdev->dev, "failed to register restart handler\n"); >> - >> dev_info(&pdev->dev, "SMP86xx/SMP87xx watchdog registered\n"); >> >> return 0; >> @@ -202,7 +193,6 @@ static int tangox_wdt_remove(struct platform_device *pdev) >> tangox_wdt_stop(&dev->wdt); >> clk_disable_unprepare(dev->clk); >> >> - unregister_restart_handler(&dev->restart); >> watchdog_unregister_device(&dev->wdt); >> >> return 0; >> >