Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1423297AbbFEOOL (ORCPT ); Fri, 5 Jun 2015 10:14:11 -0400 Received: from relay1.mentorg.com ([192.94.38.131]:57230 "EHLO relay1.mentorg.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1422697AbbFEOOG (ORCPT ); Fri, 5 Jun 2015 10:14:06 -0400 Message-ID: <5571AEA9.7010803@mentor.com> Date: Fri, 5 Jun 2015 17:14:01 +0300 From: Vladimir Zapolskiy User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Icedove/31.0 MIME-Version: 1.0 To: Markus Rinne , CC: , , Michael Grzeschik Subject: Re: [PATCH] watchdog: imx2_wdt: Fix ioctl() results References: <20150605124144.GA26755@markusri_laptop.vincit.intranet> In-Reply-To: <20150605124144.GA26755@markusri_laptop.vincit.intranet> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [137.202.0.76] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1792 Lines: 65 Hello Markus, On 05.06.2015 15:41, Markus Rinne wrote: > WDIOC_SETTIMEOUT and WDIOC_GETTIMEOUT returned the initial timeout and > not the one that was last set. Fix this by updating struct > watchdog_device member 'timeout'. This is how it's supposed to be done > according to Documentation/watchdog/watchdog-kernel-api.txt. > > This is the test case I used: > > #include > #include > #include > #include > > #include > #include > > static const int TIMEOUT = 127; > > int main(void) > { > int fd = open("/dev/watchdog", O_WRONLY); > if (fd == -1) > return EXIT_FAILURE; > > int timeout = TIMEOUT; > ioctl(fd, WDIOC_SETTIMEOUT, &timeout); > assert(timeout == TIMEOUT); > > close(fd); > > return EXIT_SUCCESS; > } > > Signed-off-by: Markus Rinne > --- > drivers/watchdog/imx2_wdt.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/watchdog/imx2_wdt.c b/drivers/watchdog/imx2_wdt.c > index 5e6d808..b636799 100644 > --- a/drivers/watchdog/imx2_wdt.c > +++ b/drivers/watchdog/imx2_wdt.c > @@ -168,6 +168,7 @@ static int imx2_wdt_set_timeout(struct watchdog_device *wdog, > > regmap_update_bits(wdev->regmap, IMX2_WDT_WCR, IMX2_WDT_WCR_WT, > WDOG_SEC_TO_COUNT(new_timeout)); > + wdog->timeout = new_timeout; > return 0; > } > > this change repeats the change sent by Michael Grzeschik one month ago -- http://www.spinics.net/lists/linux-watchdog/msg06296.html -- With best wishes, Vladimir -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/