[igt-dev] [PATCH i-g-t v2 2/2] lib/intel_chipset: Move BIT macro to common place

Lukasz Kalamarz lukasz.kalamarz at intel.com
Wed Jul 3 13:43:03 UTC 2019


This macro is defined in two tests. We can move it to common place
in ioctl_wrappers, which is included by all tests.
v2: Missed intel_device_info lib. Moved BIT definition to
intel_chipset, which is part of igt.h

Signed-off-by: Lukasz Kalamarz <lukasz.kalamarz at intel.com>
Cc: Katarzyna Dec <katarzyna.dec at intel.com>
Cc: Michal Winiarski <michal.winiarski at intel.com>
---
 lib/intel_chipset.h            | 2 ++
 lib/intel_device_info.c        | 2 --
 tests/i915/gem_ctx_isolation.c | 1 -
 tests/i915/gem_ctx_param.c     | 2 --
 4 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/lib/intel_chipset.h b/lib/intel_chipset.h
index 7fc9bd77..74a40a46 100644
--- a/lib/intel_chipset.h
+++ b/lib/intel_chipset.h
@@ -31,6 +31,8 @@
 #include <pciaccess.h>
 #include <stdbool.h>
 
+#define BIT(x) (1ul <<(x))
+
 struct pci_device *intel_get_pci_device(void);
 uint32_t intel_get_drm_devid(int fd);
 
diff --git a/lib/intel_device_info.c b/lib/intel_device_info.c
index 88be2917..be192b61 100644
--- a/lib/intel_device_info.c
+++ b/lib/intel_device_info.c
@@ -3,8 +3,6 @@
 
 #include <strings.h> /* ffs() */
 
-#define BIT(x) (1<<(x))
-
 static const struct intel_device_info intel_generic_info = {
 	.gen = 0,
 };
diff --git a/tests/i915/gem_ctx_isolation.c b/tests/i915/gem_ctx_isolation.c
index 5b054c81..c4302394 100644
--- a/tests/i915/gem_ctx_isolation.c
+++ b/tests/i915/gem_ctx_isolation.c
@@ -33,7 +33,6 @@
 #define DIRTY2 0x2
 #define RESET 0x4
 
-#define BIT(x) (1ul << (x))
 #define ENGINE(x, y) BIT(4*(x) + (y))
 
 enum {
diff --git a/tests/i915/gem_ctx_param.c b/tests/i915/gem_ctx_param.c
index fa0ab520..bd1ee399 100644
--- a/tests/i915/gem_ctx_param.c
+++ b/tests/i915/gem_ctx_param.c
@@ -32,8 +32,6 @@
 
 IGT_TEST_DESCRIPTION("Basic test for context set/get param input validation.");
 
-#define BIT(x) (1ul << (x))
-
 #define NEW_CTX	BIT(0)
 #define USER BIT(1)
 
-- 
2.20.1



More information about the igt-dev mailing list