]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
x86/topology: use bitmap_weight_from()
authorYury Norov <ynorov@nvidia.com>
Mon, 22 Dec 2025 19:11:38 +0000 (14:11 -0500)
committerYury Norov <ynorov@nvidia.com>
Mon, 23 Mar 2026 17:33:51 +0000 (13:33 -0400)
Switch topo_unit_count() to use bitmap_weight_from().

Signed-off-by: Yury Norov <ynorov@nvidia.com>
arch/x86/kernel/cpu/topology.c

index eafcb1fc185ad65565f93317248b2a13e8378a31..4913b64ec592d23ad3893044acf55bf1f22a61f2 100644 (file)
@@ -204,15 +204,11 @@ fwbug:
 static unsigned int topo_unit_count(u32 lvlid, enum x86_topology_domains at_level,
                                    unsigned long *map)
 {
-       unsigned int id, end, cnt = 0;
+       unsigned int end;
 
        /* Calculate the exclusive end */
        end = lvlid + (1U << x86_topo_system.dom_shifts[at_level]);
-
-       /* Unfortunately there is no bitmap_weight_range() */
-       for (id = find_next_bit(map, end, lvlid); id < end; id = find_next_bit(map, end, ++id))
-               cnt++;
-       return cnt;
+       return bitmap_weight_from(map, lvlid, end);
 }
 
 static __init void topo_register_apic(u32 apic_id, u32 acpi_id, bool present)