wdt: dw: Switch to using fls for log2
authorSean Anderson <seanga2@gmail.com>
Thu, 11 Mar 2021 02:02:17 +0000 (21:02 -0500)
committerLeo Yu-Chi Liang <ycliang@andestech.com>
Thu, 8 Apr 2021 07:37:27 +0000 (15:37 +0800)
log_2_n_round_up is only found in arm. fls performs the same job and is
generic.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
drivers/watchdog/designware_wdt.c

index c020324973e462759d073f334d56daaf77d5e286..1f0c5a77c929d34767af6ca2b3c5ecb165da3e71 100644 (file)
@@ -9,7 +9,6 @@
 #include <reset.h>
 #include <wdt.h>
 #include <asm/io.h>
-#include <asm/utils.h>
 #include <linux/bitops.h>
 
 #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);