Skip to contentSkip to conversation

bitmap: replace bitmap_{from,to}_u32array

PATCH New [email protected] 1 participant 1 message Feb 6, 2018

Subsystems (6)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 36/114 bitmap: replace bitmap_{from,to}_u32array

From: Yury Norov <[email protected]>
Subject: bitmap: replace bitmap_{from,to}_u32array

with bitmap_{from,to}_arr32 over the kernel. Additionally to it:
* __check_eq_bitmap() now takes single nbits argument.
* __check_eq_u32_array is not used in new test but may be used in future. So I don't remove it here, but annotate as __used.

Tested on arm64 and 32-bit BE mips.

---

 arch/arm64/kernel/perf_event.c |    5 
 drivers/perf/arm_dsu_pmu.c     |    6 
 include/linux/bitmap.h         |   11 -
 lib/bitmap.c                   |   87 -------------
 lib/test_bitmap.c              |  206 ++++---------------------------
 net/core/ethtool.c             |   53 +++----
 6 files changed, 57 insertions(+), 311 deletions(-)
arch/arm64/kernel/perf_event.c renamed from arch/arm64/kernel/perf_event.c~bitmap-replace-bitmap_fromto_u32array +2 -3
diff -puN arch/arm64/kernel/perf_event.c~bitmap-replace-bitmap_fromto_u32array arch/arm64/kernel/perf_event.c
@@ -925,9 +925,8 @@ static void __armv8pmu_probe_pmu(void *i
 	pmceid[0] = read_sysreg(pmceid0_el0);
 	pmceid[1] = read_sysreg(pmceid1_el0);
 
-	bitmap_from_u32array(cpu_pmu->pmceid_bitmap,
-			     ARMV8_PMUV3_MAX_COMMON_EVENTS, pmceid,
-			     ARRAY_SIZE(pmceid));
+	bitmap_from_arr32(cpu_pmu->pmceid_bitmap,
+			     pmceid, ARMV8_PMUV3_MAX_COMMON_EVENTS);
 }
 
 static int armv8pmu_probe_pmu(struct arm_pmu *cpu_pmu)
drivers/perf/arm_dsu_pmu.c renamed from drivers/perf/arm_dsu_pmu.c~bitmap-replace-bitmap_fromto_u32array +2 -4
diff -puN drivers/perf/arm_dsu_pmu.c~bitmap-replace-bitmap_fromto_u32array drivers/perf/arm_dsu_pmu.c
@@ -658,10 +658,8 @@ static void dsu_pmu_probe_pmu(struct dsu
 		return;
 	cpmceid[0] = __dsu_pmu_read_pmceid(0);
 	cpmceid[1] = __dsu_pmu_read_pmceid(1);
-	bitmap_from_u32array(dsu_pmu->cpmceid_bitmap,
-				DSU_PMU_MAX_COMMON_EVENTS,
-				cpmceid,
-				ARRAY_SIZE(cpmceid));
+	bitmap_from_arr32(dsu_pmu->cpmceid_bitmap, cpmceid,
+			  DSU_PMU_MAX_COMMON_EVENTS);
 }
 
 static void dsu_pmu_set_active_cpu(int cpu, struct dsu_pmu *dsu_pmu)
include/linux/bitmap.h renamed from include/linux/bitmap.h~bitmap-replace-bitmap_fromto_u32array +1 -10
diff -puN include/linux/bitmap.h~bitmap-replace-bitmap_fromto_u32array include/linux/bitmap.h
@@ -64,8 +64,6 @@
  *  bitmap_find_free_region(bitmap, bits, order)  Find and allocate bit region
  *  bitmap_release_region(bitmap, pos, order)   Free specified bit region
  *  bitmap_allocate_region(bitmap, pos, order)  Allocate specified bit region
- *  bitmap_from_u32array(dst, nbits, buf, nwords)  *dst = *buf (nwords 32b words)
- *  bitmap_to_u32array(buf, nwords, src, nbits) *buf = *dst (nwords 32b words)
  *  bitmap_from_arr32(dst, buf, nbits)          Copy nbits from u32[] buf to dst
  *  bitmap_to_arr32(buf, src, nbits)            Copy nbits from buf to u32[] dst
  *
@@ -176,14 +174,7 @@ extern void bitmap_fold(unsigned long *d
 extern int bitmap_find_free_region(unsigned long *bitmap, unsigned int bits, int order);
 extern void bitmap_release_region(unsigned long *bitmap, unsigned int pos, int order);
 extern int bitmap_allocate_region(unsigned long *bitmap, unsigned int pos, int order);
-extern unsigned int bitmap_from_u32array(unsigned long *bitmap,
-					 unsigned int nbits,
-					 const u32 *buf,
-					 unsigned int nwords);
-extern unsigned int bitmap_to_u32array(u32 *buf,
-				       unsigned int nwords,
-				       const unsigned long *bitmap,
-				       unsigned int nbits);
+
 #ifdef __BIG_ENDIAN
 extern void bitmap_copy_le(unsigned long *dst, const unsigned long *src, unsigned int nbits);
 #else
lib/bitmap.c renamed from lib/bitmap.c~bitmap-replace-bitmap_fromto_u32array +0 -87

93 lines not on this page · raw message

lib/test_bitmap.c renamed from lib/test_bitmap.c~bitmap-replace-bitmap_fromto_u32array +31 -175

241 lines not on this page · raw message

net/core/ethtool.c renamed from net/core/ethtool.c~bitmap-replace-bitmap_fromto_u32array +21 -32

77 lines not on this page · raw message

_