From cb57811fbc726cb93da92c05cdfbb880a8c78c50 Mon Sep 17 00:00:00 2001 From: Sean Anderson Date: Wed, 10 Mar 2021 21:02:17 -0500 Subject: [PATCH] wdt: dw: Switch to using fls for log2 log_2_n_round_up is only found in arm. fls performs the same job and is generic. Signed-off-by: Sean Anderson Reviewed-by: Simon Glass --- drivers/watchdog/designware_wdt.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/watchdog/designware_wdt.c b/drivers/watchdog/designware_wdt.c index c020324973..1f0c5a77c9 100644 --- a/drivers/watchdog/designware_wdt.c +++ b/drivers/watchdog/designware_wdt.c @@ -9,7 +9,6 @@ #include #include #include -#include #include #define DW_WDT_CR 0x00 @@ -35,7 +34,7 @@ static int designware_wdt_settimeout(void __iomem *base, unsigned int clk_khz, signed int i; /* calculate the timeout range value */ - i = log_2_n_round_up(timeout * clk_khz) - 16; + i = fls(timeout * clk_khz - 1) - 16; i = clamp(i, 0, 15); writel(i | (i << 4), base + DW_WDT_TORR); -- 2.39.5