linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>
Cc: Wim Van Sebroeck <wim@linux-watchdog.org>,
	linux-watchdog@vger.kernel.org, kernel@pengutronix.de,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 1/5] watchdog: f71808e_wdt: fix inaccurate report in WDIOC_GETTIMEOUT
Date: Sun, 25 Jul 2021 14:41:29 -0700	[thread overview]
Message-ID: <20210725214129.GA3578169@roeck-us.net> (raw)
In-Reply-To: <7f2a07eaa7dbd7c3f8162a89d364c3eef45883ea.1626948810.git-series.a.fatoum@pengutronix.de>

On Thu, Jul 22, 2021 at 12:14:40PM +0200, Ahmad Fatoum wrote:
> The fintek watchdog timer can configure timeouts of second granularity
> only up to 255 seconds. Beyond that, the timeout needs to be configured
> with minute granularity. WDIOC_GETTIMEOUT should report the actual
> timeout configured, not just echo back the timeout configured by the
> user. Do so.
> 
> Fixes: 96cb4eb019ce ("watchdog: f71808e_wdt: new watchdog driver for Fintek F71808E and F71882FG")
> Suggested-by: Guenter Roeck <linux@roeck-us.net>
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/watchdog/f71808e_wdt.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/watchdog/f71808e_wdt.c b/drivers/watchdog/f71808e_wdt.c
> index f60beec1bbae..f7d82d261913 100644
> --- a/drivers/watchdog/f71808e_wdt.c
> +++ b/drivers/watchdog/f71808e_wdt.c
> @@ -228,15 +228,17 @@ static int watchdog_set_timeout(int timeout)
>  
>  	mutex_lock(&watchdog.lock);
>  
> -	watchdog.timeout = timeout;
>  	if (timeout > 0xff) {
>  		watchdog.timer_val = DIV_ROUND_UP(timeout, 60);
>  		watchdog.minutes_mode = true;
> +		timeout = watchdog.timer_val * 60;
>  	} else {
>  		watchdog.timer_val = timeout;
>  		watchdog.minutes_mode = false;
>  	}
>  
> +	watchdog.timeout = timeout;
> +
>  	mutex_unlock(&watchdog.lock);
>  
>  	return 0;
> -- 
> git-series 0.9.1

  reply	other threads:[~2021-07-25 21:41 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-22 10:14 [PATCH v4 0/5] watchdog: f71808e_wdt: migrate to new kernel API Ahmad Fatoum
2021-07-22 10:14 ` [PATCH v4 1/5] watchdog: f71808e_wdt: fix inaccurate report in WDIOC_GETTIMEOUT Ahmad Fatoum
2021-07-25 21:41   ` Guenter Roeck [this message]
2021-07-22 10:14 ` [PATCH v4 2/5] watchdog: f71808e_wdt: rename variant-independent identifiers appropriately Ahmad Fatoum
2021-07-25 21:42   ` Guenter Roeck
2021-07-25 21:48   ` Guenter Roeck
2021-07-22 10:14 ` [PATCH v4 3/5] watchdog: f71808e_wdt: migrate to new kernel watchdog API Ahmad Fatoum
2021-07-25 22:02   ` Guenter Roeck
2021-07-22 10:14 ` [PATCH v4 4/5] watchdog: f71808e_wdt: refactor to platform device/driver pair Ahmad Fatoum
2021-07-25 22:03   ` Guenter Roeck
2021-07-22 10:14 ` [PATCH v4 5/5] watchdog: f71808e_wdt: dynamically allocate watchdog driver data Ahmad Fatoum
2021-07-25 22:04   ` 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=20210725214129.GA3578169@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=a.fatoum@pengutronix.de \
    --cc=kernel@pengutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=wim@linux-watchdog.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).