diff mbox series

[1/5] drm/i915: let IS_GEN receive 1 or 2 arguments

Message ID 20181101083517.20193-2-lucas.demarchi@intel.com (mailing list archive)
State New, archived
Headers show
Series Make GEN macros more similar | expand

Commit Message

Lucas De Marchi Nov. 1, 2018, 8:35 a.m. UTC
By letting IS_GEN receive more than 1 argument (besides the dev_priv) we
can use the same macro to check for ranges.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index c9e5bab6861b..3b0bdab5a57a 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -2361,9 +2361,15 @@  intel_info(const struct drm_i915_private *dev_priv)
 	GENMASK((e) - 1, (s) - 1))
 
 /* Returns true if Gen is in inclusive range [Start, End] */
-#define IS_GEN(dev_priv, s, e) \
+#define _IS_GEN_ARG2(dev_priv, s, e) \
 	(!!((dev_priv)->info.gen_mask & INTEL_GEN_MASK((s), (e))))
 
+#define _IS_GEN_ARG1(dev_priv, g) \
+	(!!((dev_priv)->info.gen_mask & BIT((g) - 1)))
+
+#define IS_GEN(dev_priv, ...) \
+	CONCATENATE(_IS_GEN_ARG, COUNT_ARGS(__VA_ARGS__))((dev_priv), ##__VA_ARGS__)
+
 /*
  * Return true if revision is in range [since,until] inclusive.
  *