@@ -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.
*
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(-)