Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp410193pxv; Thu, 22 Jul 2021 03:19:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyUu9e7Ht3tCuO6c4+0aJlcv/3bBtd5Dd35u9/ZI98j4ed1+S6uLI1DuBL570K0UQMaVOZc X-Received: by 2002:a17:907:7608:: with SMTP id jx8mr42498480ejc.233.1626949195928; Thu, 22 Jul 2021 03:19:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626949195; cv=none; d=google.com; s=arc-20160816; b=moZQfYA5S7JiNiOIYcq2L7+X8wSDtHmv/rjbFUoHarQY396m3OaWjK35B7fHxA1sRH mfgnYJcmlYfrWg3qkjxun4StmXHRlzJizomfuF4zVCukbgRe0dXvkLjP80WTSvoo3T70 KnHqfdhWw6yWraanzxK87UBMioQU1sVc7KXa/iNIky9GoXlS8sZ3LorEzGwUwqSBQFx0 EUWAvKXl/Z4aBx0e5qQdScJAymAKM00/VX5OZ6nwIbtG5eCq6yZOZSZ0LI+ug6qgMzM8 xfjCMx7aC72sSdh4FlefcOBr+9v5N3YFlE5MTyl6JUzMw1lyGQ9N3UDkknETzBv62dIP JdKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=s13K4EQevqZ5Mm30L4Tsv5NCOp29ON2iiiH3l5cS2pA=; b=sy91Fn3KKeDDAftg8FjqBQ34H1zs70wxj+c5yG6YTkr5gA4i+phgl82nsaaLQ+620T Pjss5XWaFVtdSL1qkCkoBNYMZkbKctJQEueYWEeYqeWvrhHpn6vBkzfudnQdfCDZg92j jA2Ab+sAYFWxrmfw85dA5hQGJan+zg17Kh3kJcpF9XVmb7T1zV2z3pcUSa/2OodGzQWY jqxBZwKr8X6DC7+0scJL9vhdl4YNGharVSq9TmdXLP1xCKQiGZCgAlY2lWb8ZbX6ZPmH 32CvLg/dSeCwjSUzKo7wK+pWLCkykTrp+IARnnMMYyi8Oqx3gcAVsIdEsrZ0MTAiLvAz RJVQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o4si27466165ejg.206.2021.07.22.03.19.31; Thu, 22 Jul 2021 03:19:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231708AbhGVJep (ORCPT + 99 others); Thu, 22 Jul 2021 05:34:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231531AbhGVJeo (ORCPT ); Thu, 22 Jul 2021 05:34:44 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62B41C061575 for ; Thu, 22 Jul 2021 03:15:19 -0700 (PDT) Received: from dude.hi.pengutronix.de ([2001:67c:670:100:1d::7]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m6Vj8-00019U-Mu; Thu, 22 Jul 2021 12:14:50 +0200 Received: from afa by dude.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1m6Vj7-0001KQ-3C; Thu, 22 Jul 2021 12:14:49 +0200 From: Ahmad Fatoum To: Wim Van Sebroeck , Guenter Roeck , linux-watchdog@vger.kernel.org Cc: kernel@pengutronix.de, linux-kernel@vger.kernel.org, Ahmad Fatoum Subject: [PATCH v4 1/5] watchdog: f71808e_wdt: fix inaccurate report in WDIOC_GETTIMEOUT Date: Thu, 22 Jul 2021 12:14:40 +0200 Message-Id: <7f2a07eaa7dbd7c3f8162a89d364c3eef45883ea.1626948810.git-series.a.fatoum@pengutronix.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::7 X-SA-Exim-Mail-From: afa@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Signed-off-by: Ahmad Fatoum --- 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