]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
watchdog: s3c2410_wdt: Replace hardcoded values with macro definitions
authorSangwook Shin <sw617.shin@samsung.com>
Mon, 18 Aug 2025 02:18:22 +0000 (11:18 +0900)
committerWim Van Sebroeck <wim@linux-watchdog.org>
Fri, 12 Sep 2025 16:06:31 +0000 (18:06 +0200)
Modify the code to utilize macro-defined values instead of hardcoded
values. The value 0x100 in the s3c2410wdt_set_heartbeat function represents
S3C2410_WTCON_PRESCALE_MAX + 1, but it is hardcoded, making its meaning
difficult to understand and reducing code readability.

Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
Signed-off-by: Sangwook Shin <sw617.shin@samsung.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
drivers/watchdog/s3c2410_wdt.c

index 40901bdac42613458f93c09654353190785ff072..95f7207e390a3633f79eac981ee8646347b1e44f 100644 (file)
@@ -587,7 +587,7 @@ static int s3c2410wdt_set_heartbeat(struct watchdog_device *wdd,
        if (count >= 0x10000) {
                divisor = DIV_ROUND_UP(count, 0xffff);
 
-               if (divisor > 0x100) {
+               if (divisor > S3C2410_WTCON_PRESCALE_MAX + 1) {
                        dev_err(wdt->dev, "timeout %d too big\n", timeout);
                        return -EINVAL;
                }