android_kernel_xiaomi_sm7250/include/linux/bits.h
Greg Kroah-Hartman fea30ad1bd ANDROID: preserve CRC for some DRM functions
Commit 4523b6cac7 ("linux/bits.h: make BIT(), GENMASK(), and friends
available in assembly") caused the BIT_UUL() and BIT_MASK() macros to be
redefined a bit to resolve some build problems when using those macros
in assembly files.  Unfortunatly changing these caused the CRC values of
a bunch of DRM functions to change as a new set of () were used in the
macros now.

Fix this all up by going back to the old versions if we are building the
CRCs, otherwise use the real versions of these macros.

Bug: 161946584
Fixes: 4523b6cac7 ("linux/bits.h: make BIT(), GENMASK(), and friends available in assembly")
Change-Id: I15d7b91ec349fe557a8458d9f1a851bb07a8b116
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2022-11-14 11:23:27 +00:00

40 lines
1.1 KiB
C

/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __LINUX_BITS_H
#define __LINUX_BITS_H
#include <linux/const.h>
#ifdef __GENKSYMS__
#include <vdso/bits.h>
/*
* Old version of this macro to preserve the CRC signatures of some drm symbols.
* Crazy but true...
*/
#define BIT_ULL(nr) (1ULL << (nr))
#define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG))
#else
#include <asm/bitsperlong.h>
#define BIT(nr) (UL(1) << (nr))
#define BIT_ULL(nr) (ULL(1) << (nr))
#define BIT_MASK(nr) (UL(1) << ((nr) % BITS_PER_LONG))
#endif
#define BIT_WORD(nr) ((nr) / BITS_PER_LONG)
#define BIT_ULL_MASK(nr) (ULL(1) << ((nr) % BITS_PER_LONG_LONG))
#define BIT_ULL_WORD(nr) ((nr) / BITS_PER_LONG_LONG)
#define BITS_PER_BYTE 8
/*
* Create a contiguous bitmask starting at bit position @l and ending at
* position @h. For example
* GENMASK_ULL(39, 21) gives us the 64bit vector 0x000000ffffe00000.
*/
#define GENMASK(h, l) \
(((~UL(0)) - (UL(1) << (l)) + 1) & \
(~UL(0) >> (BITS_PER_LONG - 1 - (h))))
#define GENMASK_ULL(h, l) \
(((~ULL(0)) - (ULL(1) << (l)) + 1) & \
(~ULL(0) >> (BITS_PER_LONG_LONG - 1 - (h))))
#endif /* __LINUX_BITS_H */