]> Git Repo - linux.git/commitdiff
risc-v: replace bitmap_weight with bitmap_empty in riscv_fill_hwcap()
authorYury Norov <[email protected]>
Sun, 8 May 2022 14:49:50 +0000 (07:49 -0700)
committerYury Norov <[email protected]>
Fri, 3 Jun 2022 13:52:57 +0000 (06:52 -0700)
bitmap_empty() is better than bitmap_weight() because it may return
earlier, and improves on readability.

CC: Albert Ou <[email protected]>
CC: Anup Patel <[email protected]>
CC: Atish Patra <[email protected]>
CC: Jisheng Zhang <[email protected]>
CC: Palmer Dabbelt <[email protected]>
CC: Paul Walmsley <[email protected]>
CC: Tsukasa OI <[email protected]>
CC: [email protected]
CC: [email protected]
Signed-off-by: Yury Norov <[email protected]>
Reviewed-by: Anup Patel <[email protected]>
arch/riscv/kernel/cpufeature.c

index 1b2d42d7f589775a4c040acf2917cb28c459952f..f0298d756f66ef64dc42472c9e9a423082264132 100644 (file)
@@ -206,11 +206,10 @@ void __init riscv_fill_hwcap(void)
                else
                        elf_hwcap = this_hwcap;
 
-               if (bitmap_weight(riscv_isa, RISCV_ISA_EXT_MAX))
-                       bitmap_and(riscv_isa, riscv_isa, this_isa, RISCV_ISA_EXT_MAX);
-               else
+               if (bitmap_empty(riscv_isa, RISCV_ISA_EXT_MAX))
                        bitmap_copy(riscv_isa, this_isa, RISCV_ISA_EXT_MAX);
-
+               else
+                       bitmap_and(riscv_isa, riscv_isa, this_isa, RISCV_ISA_EXT_MAX);
        }
 
        /* We don't support systems with F but without D, so mask those out
This page took 0.059772 seconds and 4 git commands to generate.