From patchwork Fri May 8 13:46:42 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Twiss X-Patchwork-Id: 6365851 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A2290BEEE1 for ; Fri, 8 May 2015 13:47:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B409A201C8 for ; Fri, 8 May 2015 13:47:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C69F4201BC for ; Fri, 8 May 2015 13:47:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752770AbbEHNrG (ORCPT ); Fri, 8 May 2015 09:47:06 -0400 Received: from mail1.bemta5.messagelabs.com ([195.245.231.138]:62608 "EHLO mail1.bemta5.messagelabs.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752505AbbEHNrC convert rfc822-to-8bit (ORCPT ); Fri, 8 May 2015 09:47:02 -0400 Received: from [85.158.139.35] by server-2.bemta-5.messagelabs.com id 97/68-03031-44EBC455; Fri, 08 May 2015 13:46:44 +0000 X-Env-Sender: stwiss.opensource@diasemi.com X-Msg-Ref: server-5.tower-179.messagelabs.com!1431092804!34955508!1 X-Originating-IP: [94.185.165.51] X-StarScan-Received: X-StarScan-Version: 6.13.14; banners=-,-,- X-VirusChecked: Checked Received: (qmail 2280 invoked from network); 8 May 2015 13:46:44 -0000 Received: from mailrelay2.diasemi.com (HELO sw-ex-cashub01.diasemi.com) (94.185.165.51) by server-5.tower-179.messagelabs.com with AES128-SHA encrypted SMTP; 8 May 2015 13:46:44 -0000 Received: from SW-EX-MBX02.diasemi.com ([169.254.4.97]) by sw-ex-cashub01.diasemi.com ([10.20.16.141]) with mapi id 14.03.0181.006; Fri, 8 May 2015 14:46:43 +0100 From: "Opensource [Steve Twiss]" To: Guenter Roeck , LINUXKERNEL , LINUXWATCHDOG , Wim Van Sebroeck CC: Alessandro Zummo , DEVICETREE , David Dajun Chen , Dmitry Torokhov , Ian Campbell , Kumar Gala , LINUXINPUT , Lee Jones , Liam Girdwood , Mark Brown , "Mark Rutland" , Pawel Moll , RTCLINUX , Rob Herring , Samuel Ortiz , Support Opensource Subject: RE: [PATCH V1 5/6] watchdog: da9062: DA9062 watchdog driver Thread-Topic: [PATCH V1 5/6] watchdog: da9062: DA9062 watchdog driver Thread-Index: AQHQeRyTN/8sGtEcQUaqI/lc3woPV51S3H4AgB9X5kA= Date: Fri, 8 May 2015 13:46:42 +0000 Message-ID: <6ED8E3B22081A4459DAC7699F3695FB7014B227F1A@SW-EX-MBX02.diasemi.com> References: <2afd9f55c71553186e99bfe386312f0c7d7501ed.1429280614.git.stwiss.opensource@diasemi.com> <55327DDA.4080003@roeck-us.net> In-Reply-To: <55327DDA.4080003@roeck-us.net> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.20.26.77] MIME-Version: 1.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 18 April 2015 16:53 Guenter Roeck wrote: Hi Guenter, There were some missing explanations in my previous e-mails for some of your comments. Please find them below. During the da9062_wdt_probe() there were several ignored error paths and a missing cleanup . I intend to rectify this with the following: Also there was an explanation required for the confusing ping() function inside the driver probe() ... > > + da9062_wdt_ping(&wdt->wdtdev); [...] > That ping is asking for an explanation. Does it imply that the watchdog is > known to be running and cannot be stopped ? Pinging the DA9062 watchdog has no effect if it is disabled. But I guessed that in a real application if the watchdog -was- enabled from start-up then the first thing the driver needed to do was kick the watchdog. I could have put protection around it, say by reading the TWDSCALE bit for whether the watchdog was enabled, and that would have made it more explicit but in this case it wouldn't matter. This can be removed if you prefer. Regards, Steve --- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- a/linux-next/v4.0/drivers/watchdog/da9062_wdt.c +++ b/linux-next/v4.0/drivers/watchdog/da9062_wdt.c @@ -232,8 +232,11 @@ static int da9062_wdt_probe(struct platform_device *pdev) dev_set_drvdata(&pdev->dev, wdt); irq = platform_get_irq_byname(pdev, "WDG_WARN"); - if (irq < 0) + if (irq < 0) { dev_err(wdt->hw->dev, "Failed to get IRQ.\n"); + ret = irq; + goto error; + } ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, da9062_wdt_wdg_warn_irq_handler, @@ -242,20 +245,23 @@ static int da9062_wdt_probe(struct platform_device *pdev) if (ret) { dev_err(wdt->hw->dev, "Failed to request watchdog device IRQ.\n"); + goto error; } ret = watchdog_register_device(&wdt->wdtdev); - if (ret < 0) + if (ret < 0) { dev_err(wdt->hw->dev, "watchdog registration incomplete (%d)\n", ret); + goto error; + } da9062_set_window_start(wdt); ret = da9062_wdt_ping(&wdt->wdtdev); if (ret < 0) - dev_err(wdt->hw->dev, - "failed to ping the watchdog (%d)\n", ret); + watchdog_unregister_device(&wdt->wdtdev); +error: return ret; }