From nobody Mon Oct 6 08:26:52 2025 Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 74BE42749DE for ; Thu, 24 Jul 2025 08:13:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.254.224.25 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753344822; cv=none; b=iv5EfuqsCE0s7ZirjoWwEBF8Z20Z80qzQ/Qe4nKsyoS3BgZekDLhPh2aY1dt3O8hY32pjFAujySx4X0Ks1F3AjyVCUZBYaBOQoabDh5UHrZ0sAg1rVycyHqLETX2FFoutKF7yRFdFz3fwbWOxBLW1cMgf9uUI2Z9/jZWL/qe9tw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753344822; c=relaxed/simple; bh=Y5pH19HmSiQddiETs6OYDLNHfOX27xGom9eX1MuqH38=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=BQxfGLCHUNf8Cq2r8f+btOjOuJzPWGfI2GEYDy1tOFDTKf3jYzOpL6MTKHFKoCRqj0714hPD2c3D8+dYqU56cLvZSRvBHgWOKcFdSjyfAuhzYlx+shq9FyJBGTHtjwvB4c7L33MyUSP+0RDC3FVJUAg2OezqsdKgn6DwZrwzKr4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=mlfnrnGL; arc=none smtp.client-ip=203.254.224.25 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="mlfnrnGL" Received: from epcas2p1.samsung.com (unknown [182.195.41.53]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20250724081338epoutp029daa8272d9fb0263dbcfbe81e1777556~VIdKbf62Y0996109961epoutp02g for ; Thu, 24 Jul 2025 08:13:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20250724081338epoutp029daa8272d9fb0263dbcfbe81e1777556~VIdKbf62Y0996109961epoutp02g DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1753344818; bh=Mp1uEyU7lbaGGVz3c4DfJHeeiGKIH/ejywxPc0mBmk0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mlfnrnGL6sGacusIhqRCqhDaQj1vJc7jh0SJ7R2dqKYlaQGuUyLzB5s/oCgkBnPzd bq5ggpz2IZn3MMJmLIn8+ZxcxfSOY4443O7GGEVSkK6edVx+oSG311b/yStNUY3Vb7 eXNpQl3poVg10pXAFimbf/KBTob4d9ajWxRGfFpI= Received: from epsnrtp01.localdomain (unknown [182.195.42.153]) by epcas2p3.samsung.com (KnoxPortal) with ESMTPS id 20250724081338epcas2p38cd1b2986e4d286abc157f9a24c44881~VIdKGGLg20887108871epcas2p3O; Thu, 24 Jul 2025 08:13:38 +0000 (GMT) Received: from epcas2p4.samsung.com (unknown [182.195.36.88]) by epsnrtp01.localdomain (Postfix) with ESMTP id 4bnkKY4p1yz6B9m6; Thu, 24 Jul 2025 08:13:37 +0000 (GMT) Received: from epsmtip1.samsung.com (unknown [182.195.34.30]) by epcas2p3.samsung.com (KnoxPortal) with ESMTPA id 20250724081336epcas2p38e95932ddc5c702e05a6436f05582993~VIdJHibIJ1011010110epcas2p3D; Thu, 24 Jul 2025 08:13:36 +0000 (GMT) Received: from localhost.localdomain (unknown [10.229.9.126]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20250724081336epsmtip150ded574fc6f000f3cb609dd969de014~VIdJEWCh42170021700epsmtip1L; Thu, 24 Jul 2025 08:13:36 +0000 (GMT) From: Sangwook Shin To: krzk@kernel.org, alim.akhtar@samsung.com, wim@linux-watchdog.org, linux@roeck-us.net, semen.protsenko@linaro.org, khwan.seo@samsung.com, dongil01.park@samsung.com Cc: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, Sangwook Shin Subject: [PATCH v4 2/4] watchdog: s3c2410_wdt: Fix max_timeout being calculated larger Date: Thu, 24 Jul 2025 17:08:52 +0900 Message-Id: <20250724080854.3866566-3-sw617.shin@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250724080854.3866566-1-sw617.shin@samsung.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CMS-MailID: 20250724081336epcas2p38e95932ddc5c702e05a6436f05582993 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P cpgsPolicy: CPGSC10-234,N X-CFilter-Loop: Reflected X-CMS-RootMailID: 20250724081336epcas2p38e95932ddc5c702e05a6436f05582993 References: <20250724080854.3866566-1-sw617.shin@samsung.com> Fix the issue of max_timeout being calculated larger than actual value. The calculation result of freq / (S3C2410_WTCON_PRESCALE_MAX + 1) / S3C2410_WTCON_MAXDIV is smaller than the actual value because the remainder is discarded during the calculation process. This leads to a larger calculated value for max_timeout compared to the actual settable value. A ceiling operation is applied in the calculation process to resolve this. Reviewed-by: Alim Akhtar Signed-off-by: Sangwook Shin --- drivers/watchdog/s3c2410_wdt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c index 95f7207e390a..31f7e1ec779e 100644 --- a/drivers/watchdog/s3c2410_wdt.c +++ b/drivers/watchdog/s3c2410_wdt.c @@ -411,8 +411,8 @@ static inline unsigned int s3c2410wdt_max_timeout(struc= t s3c2410_wdt *wdt) { const unsigned long freq =3D s3c2410wdt_get_freq(wdt); =20 - return S3C2410_WTCNT_MAXCNT / (freq / (S3C2410_WTCON_PRESCALE_MAX + 1) - / S3C2410_WTCON_MAXDIV); + return S3C2410_WTCNT_MAXCNT / DIV_ROUND_UP(freq, + (S3C2410_WTCON_PRESCALE_MAX + 1) * S3C2410_WTCON_MAXDIV); } =20 static int s3c2410wdt_disable_wdt_reset(struct s3c2410_wdt *wdt, bool mask) --=20 2.25.1