Skip to content

Commit

Permalink
types.h: don't depend on linux/bits.h
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
mchehab committed Jul 18, 2024
1 parent 99ef0f0 commit 2ff9c3e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 0 additions & 1 deletion ras-record.h
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@ struct ras_cxl_memory_module_event;

#ifdef HAVE_SQLITE3


struct sqlite3_priv {
sqlite3 *db;
sqlite3_stmt *stmt_mc_event;
Expand Down
9 changes: 8 additions & 1 deletion types.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include <asm/bitsperlong.h>
#include <assert.h>
#include <errno.h>
#include <linux/bits.h>
#include <stddef.h>
#include <stdint.h>

Expand Down Expand Up @@ -110,6 +109,14 @@
(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) \
Expand Down

0 comments on commit 2ff9c3e

Please sign in to comment.