diff mbox series

[v2,1/7] Revert "drm/i915: Kill GEN_FOREVER"

Message ID 20181106215123.27568-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. 6, 2018, 9:51 p.m. UTC
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@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

Comments

Rodrigo Vivi Nov. 21, 2018, 10:22 p.m. UTC | #1
On Tue, Nov 06, 2018 at 01:51:17PM -0800, Lucas De Marchi wrote:
> 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@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) \

As I mentioned before I don't like the forever as start, but this could
be removed later so this can be a pure revert?!

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

> +)
>  
> -/* 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
>
diff mbox series

Patch

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))))