]> www.infradead.org Git - users/mchehab/rasdaemon.git/commitdiff
types.h: don't depend on linux/bits.h
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Thu, 18 Jul 2024 15:51:28 +0000 (17:51 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Thu, 18 Jul 2024 15:51:28 +0000 (17:51 +0200)
Such include would require Kernel sources to be installed.
We don't really need that: Just copy the two GENMASK macros
and be it.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
ras-record.h
types.h

index 3fe332e791365c6e2575c52d6108377f6e566239..750e2bb949802d15fa2ba9036991ab34c02c863e 100644 (file)
@@ -263,7 +263,6 @@ struct ras_cxl_memory_module_event;
 
 #ifdef HAVE_SQLITE3
 
-
 struct sqlite3_priv {
        sqlite3         *db;
        sqlite3_stmt    *stmt_mc_event;
diff --git a/types.h b/types.h
index d0b4ee316c92dd289b941213202c1fa3b26eedfe..8b8a8ec8fe5be0e5f24351a2b63cf4f5849057c2 100644 (file)
--- a/types.h
+++ b/types.h
@@ -24,7 +24,6 @@
 #include <asm/bitsperlong.h>
 #include <assert.h>
 #include <errno.h>
-#include <linux/bits.h>
 #include <stddef.h>
 #include <stdint.h>
 
        (BUILD_BUG_ON_ZERO(__builtin_choose_expr( \
                __is_constexpr((l) > (h)), (l) > (h), 0)))
 
+#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))))
+
 #define GENMASK(h, l) \
        (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
 #define GENMASK_ULL(h, l) \