Commit 587aa96d authored by Long Li's avatar Long Li
Browse files

tools: fix implicit declaration of function __ALIGN_KERNEL

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/IAQOJ9


CVE: NA

----------------------------------------

After mergerd commit "bitmap: introduce generic optimizedbitmap_size()",
When compiling tools/perf, I encountered the following error. I reverted
the changes that added bitmap_size() in tools/include/linux/bitmap.h.
There are no functional changes.

 error: implicit declaration of function \
	 ‘__ALIGN_KERNEL’ [-Werror=implicit-function-declaration]
 #define ALIGN(x, a)  __ALIGN_KERNEL((x), (a))

Fixes: 9e8111c5 ("bitmap: introduce generic optimized bitmap_size()")
Signed-off-by: default avatarLong Li <leo.lilong@huawei.com>
parent ecca3ab8
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -27,14 +27,14 @@ int __bitmap_and(unsigned long *dst, const unsigned long *bitmap1,
#define small_const_nbits(nbits) \
	(__builtin_constant_p(nbits) && (nbits) <= BITS_PER_LONG)

#define bitmap_size(nbits)	(ALIGN(nbits, BITS_PER_LONG) / BITS_PER_BYTE)

static inline void bitmap_zero(unsigned long *dst, int nbits)
{
	if (small_const_nbits(nbits))
		*dst = 0UL;
	else {
		memset(dst, 0, bitmap_size(nbits));
		int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long);

		memset(dst, 0, len);
	}
}

@@ -120,7 +120,7 @@ static inline int test_and_clear_bit(int nr, unsigned long *addr)
 */
static inline unsigned long *bitmap_alloc(int nbits)
{
	return calloc(1, bitmap_size(nbits));
	return calloc(1, BITS_TO_LONGS(nbits) * sizeof(unsigned long));
}

/*