From: "Alim Akhtar" <alim.akhtar@samsung.com>
To: "'Sangwook Shin'" <sw617.shin@samsung.com>, <krzk@kernel.org>,
<wim@linux-watchdog.org>, <linux@roeck-us.net>
Cc: <linux-arm-kernel@lists.infradead.org>,
<linux-samsung-soc@vger.kernel.org>,
<linux-watchdog@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH v3 RESEND 2/5] watchdog: s3c2410_wdt: Fix max_timeout being calculated larger
Date: Thu, 24 Jul 2025 11:23:54 +0530 [thread overview]
Message-ID: <2b5d01dbfc5f$57d9dd30$078d9790$@samsung.com> (raw)
In-Reply-To: <20250714055440.3138135-3-sw617.shin@samsung.com>
> -----Original Message-----
> From: Sangwook Shin <sw617.shin@samsung.com>
> Sent: Monday, July 14, 2025 11:25 AM
> To: krzk@kernel.org; alim.akhtar@samsung.com; wim@linux-watchdog.org;
> linux@roeck-us.net
> 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 <sw617.shin@samsung.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@samsung.com>
> ---
Reviewed-by: Alim Akhtar <alim.akhtar@samsung.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
next prev parent reply other threads:[~2025-07-24 5:58 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20250714055850epcas2p454265f0cc65a80e80e536a4e88819e2a@epcas2p4.samsung.com>
2025-07-14 5:54 ` [PATCH v3 RESEND 0/5] Increase max timeout value of s3c2410 watchdog Sangwook Shin
2025-07-14 5:54 ` [PATCH v3 RESEND 1/5] watchdog: s3c2410_wdt: Replace hardcoded values with macro definitions Sangwook Shin
2025-07-24 5:53 ` Alim Akhtar
2025-07-24 7:14 ` Sam Protsenko
2025-07-14 5:54 ` [PATCH v3 RESEND 2/5] watchdog: s3c2410_wdt: Fix max_timeout being calculated larger Sangwook Shin
2025-07-24 5:53 ` Alim Akhtar [this message]
2025-07-14 5:54 ` [PATCH v3 RESEND 3/5] watchdog: s3c2410_wdt: Increase max timeout value of watchdog Sangwook Shin
2025-07-14 6:04 ` Krzysztof Kozlowski
2025-07-14 8:17 ` sw617.shin
2025-07-24 5:57 ` Alim Akhtar
2025-07-14 5:54 ` [PATCH v3 RESEND 4/5] watchdog: s3c2410_wdt: exynosautov920: Enable QUIRK_HAS_32BIT_MAXCNT Sangwook Shin
2025-07-14 6:04 ` Krzysztof Kozlowski
2025-07-14 5:54 ` [PATCH v3 RESEND 5/5] watchdog: s3c2410_wdt: exynosautov9: Enable supported features Sangwook Shin
2025-07-24 5:58 ` Alim Akhtar
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='2b5d01dbfc5f$57d9dd30$078d9790$@samsung.com' \
--to=alim.akhtar@samsung.com \
--cc=krzk@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=sw617.shin@samsung.com \
--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 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.