All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
To: Markus Rinne <markus.rinne@vincit.fi>, <wim@iguana.be>
Cc: <linux-watchdog@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	Michael Grzeschik <m.grzeschik@pengutronix.de>
Subject: Re: [PATCH] watchdog: imx2_wdt: Fix ioctl() results
Date: Fri, 5 Jun 2015 17:14:01 +0300	[thread overview]
Message-ID: <5571AEA9.7010803@mentor.com> (raw)
In-Reply-To: <20150605124144.GA26755@markusri_laptop.vincit.intranet>

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 <fcntl.h>
> #include <linux/watchdog.h>
> #include <sys/stat.h>
> #include <sys/types.h>
> 
> #include <assert.h>
> #include <stdlib.h>
> 
> 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 <markus.rinne@vincit.fi>
> ---
>  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

  parent reply	other threads:[~2015-06-05 14:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-05 12:41 [PATCH] watchdog: imx2_wdt: Fix ioctl() results Markus Rinne
2015-06-05 13:14 ` Guenter Roeck
2015-06-05 14:14 ` Vladimir Zapolskiy [this message]
2015-06-05 14:38   ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5571AEA9.7010803@mentor.com \
    --to=vladimir_zapolskiy@mentor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=m.grzeschik@pengutronix.de \
    --cc=markus.rinne@vincit.fi \
    --cc=wim@iguana.be \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.