[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2b5d01dbfc5f$57d9dd30$078d9790$@samsung.com>
Date: Thu, 24 Jul 2025 11:23:54 +0530
From: "Alim Akhtar" <alim.akhtar@...sung.com>
To: "'Sangwook Shin'" <sw617.shin@...sung.com>, <krzk@...nel.org>,
<wim@...ux-watchdog.org>, <linux@...ck-us.net>
Cc: <linux-arm-kernel@...ts.infradead.org>,
<linux-samsung-soc@...r.kernel.org>, <linux-watchdog@...r.kernel.org>,
<linux-kernel@...r.kernel.org>
Subject: RE: [PATCH v3 RESEND 2/5] watchdog: s3c2410_wdt: Fix max_timeout
being calculated larger
> -----Original Message-----
> From: Sangwook Shin <sw617.shin@...sung.com>
> Sent: Monday, July 14, 2025 11:25 AM
> To: krzk@...nel.org; alim.akhtar@...sung.com; wim@...ux-watchdog.org;
> linux@...ck-us.net
> Cc: linux-arm-kernel@...ts.infradead.org; linux-samsung-
> soc@...r.kernel.org; linux-watchdog@...r.kernel.org; linux-
> kernel@...r.kernel.org; Sangwook Shin <sw617.shin@...sung.com>
> Subject: [PATCH v3 RESEND 2/5] watchdog: s3c2410_wdt: Fix max_timeout
> being calculated larger
>
> 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.
>
> Signed-off-by: Sangwook Shin <sw617.shin@...sung.com>
> ---
Reviewed-by: Alim Akhtar <alim.akhtar@...sung.com>
> 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(struct s3c2410_wdt *wdt) {
> const unsigned long freq = s3c2410wdt_get_freq(wdt);
>
> - 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);
> }
>
> static int s3c2410wdt_disable_wdt_reset(struct s3c2410_wdt *wdt, bool
> mask)
> --
> 2.25.1
Powered by blists - more mailing lists