[Intel-gfx] [PATCH v2 1/7] Revert "drm/i915: Kill GEN_FOREVER"

Lucas De Marchi lucas.demarchi at intel.com
Tue Nov 6 21:51:17 UTC 2018


This reverts commit 5bc0e89ff1bee1566bd2fbd1142dce001c068aeb.

The macro was added and then never used so it was removed. However
after removal it was noticed that it was actually something that should
indeed be useful to out gen check macros to make use of.

Let's get the define back and start using it in follow up changes.

Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 2a88a7eb871b..8839a34f7648 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -2360,12 +2360,20 @@ intel_info(const struct drm_i915_private *dev_priv)
 #define REVID_FOREVER		0xff
 #define INTEL_REVID(dev_priv)	((dev_priv)->drm.pdev->revision)
 
+#define GEN_FOREVER (0)
+
 #define INTEL_GEN_MASK(s, e) ( \
 	BUILD_BUG_ON_ZERO(!__builtin_constant_p(s)) + \
 	BUILD_BUG_ON_ZERO(!__builtin_constant_p(e)) + \
-	GENMASK((e) - 1, (s) - 1))
+	GENMASK((e) != GEN_FOREVER ? (e) - 1 : BITS_PER_LONG - 1, \
+		(s) != GEN_FOREVER ? (s) - 1 : 0) \
+)
 
-/* Returns true if Gen is in inclusive range [Start, End] */
+/*
+ * Returns true if Gen is in inclusive range [Start, End].
+ *
+ * Use GEN_FOREVER for unbound start and or end.
+ */
 #define IS_GEN(dev_priv, s, e) \
 	(!!((dev_priv)->info.gen_mask & INTEL_GEN_MASK((s), (e))))
 
-- 
2.19.1.1.g56c4683e68



More information about the Intel-gfx mailing list