[Drbd-dev] [PATCH] drbd: Rename LEVEL to VLI_LEVEL to avoid name clash
Helge Deller
deller at gmx.de
Mon May 27 17:42:27 CEST 2019
Using a generic word like LEVEL is bad idea - it can easily clash with another
LEVEL defined somewhere else.
In this case, it clashed with the LEVEL defined in arch/parisc/include/asm/assembly.h
when the header file got included via jump_level.h.
This patch replaces the LEVEL defined in drbd_vli.h by VLI_LEVEL.
Another patch renames the LEVEL defined in arch/parisc/include/asm/assembly.h.
Reported-by: kbuild test robot <lkp at intel.com>
Signed-off-by: Helge Deller <deller at gmx.de>
diff --git a/drivers/block/drbd/drbd_vli.h b/drivers/block/drbd/drbd_vli.h
index 8cb1532a3816..d7ced8626035 100644
--- a/drivers/block/drbd/drbd_vli.h
+++ b/drivers/block/drbd/drbd_vli.h
@@ -121,22 +121,22 @@ prefix data bits max val Nº data bits
1 16 32 64
*/
-/* LEVEL: (total bits, prefix bits, prefix value),
+/* VLI_LEVEL: (total bits, prefix bits, prefix value),
* sorted ascending by number of total bits.
* The rest of the code table is calculated at compiletime from this. */
/* fibonacci data 1, 1, ... */
#define VLI_L_1_1() do { \
- LEVEL( 2, 1, 0x00); \
- LEVEL( 3, 2, 0x01); \
- LEVEL( 5, 3, 0x03); \
- LEVEL( 7, 4, 0x07); \
- LEVEL(10, 5, 0x0f); \
- LEVEL(14, 6, 0x1f); \
- LEVEL(21, 8, 0x3f); \
- LEVEL(29, 8, 0x7f); \
- LEVEL(42, 8, 0xbf); \
- LEVEL(64, 8, 0xff); \
+ VLI_LEVEL( 2, 1, 0x00); \
+ VLI_LEVEL( 3, 2, 0x01); \
+ VLI_LEVEL( 5, 3, 0x03); \
+ VLI_LEVEL( 7, 4, 0x07); \
+ VLI_LEVEL(10, 5, 0x0f); \
+ VLI_LEVEL(14, 6, 0x1f); \
+ VLI_LEVEL(21, 8, 0x3f); \
+ VLI_LEVEL(29, 8, 0x7f); \
+ VLI_LEVEL(42, 8, 0xbf); \
+ VLI_LEVEL(64, 8, 0xff); \
} while (0)
/* finds a suitable level to decode the least significant part of in.
@@ -147,7 +147,7 @@ static inline int vli_decode_bits(u64 *out, const u64 in)
{
u64 adj = 1;
-#define LEVEL(t,b,v) \
+#define VLI_LEVEL(t,b,v) \
do { \
if ((in & ((1 << b) -1)) == v) { \
*out = ((in & ((~0ULL) >> (64-t))) >> b) + adj; \
@@ -160,7 +160,7 @@ static inline int vli_decode_bits(u64 *out, const u64 in)
/* NOT REACHED, if VLI_LEVELS code table is defined properly */
BUG();
-#undef LEVEL
+#undef VLI_LEVEL
}
/* return number of code bits needed,
@@ -173,7 +173,7 @@ static inline int __vli_encode_bits(u64 *out, const u64 in)
if (in == 0)
return -EINVAL;
-#define LEVEL(t,b,v) do { \
+#define VLI_LEVEL(t,b,v) do { \
max += 1ULL << (t - b); \
if (in <= max) { \
if (out) \
@@ -186,7 +186,7 @@ static inline int __vli_encode_bits(u64 *out, const u64 in)
VLI_L_1_1();
return -EOVERFLOW;
-#undef LEVEL
+#undef VLI_LEVEL
}
#undef VLI_L_1_1
More information about the drbd-dev
mailing list