diff mbox

[09/13] drm/i915: Remove identical macros

Message ID 1475163356-3463-10-git-send-email-tvrtko.ursulin@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Tvrtko Ursulin Sept. 29, 2016, 3:35 p.m. UTC
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Remove some macros which are now obviously identical.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 drivers/gpu/drm/i915/intel_uncore.c | 30 +++++++-----------------------
 1 file changed, 7 insertions(+), 23 deletions(-)

Comments

Joonas Lahtinen Sept. 30, 2016, 7:29 a.m. UTC | #1
On to, 2016-09-29 at 16:35 +0100, Tvrtko Ursulin wrote:
> vlv_read##x(struct drm_i915_private *dev_priv, i915_reg_t reg, bool trace) { \
> 
>  	enum forcewake_domains fw_engine; \
>  	GEN6_READ_HEADER(x); \
> -	fw_engine = __vlv_reg_read_fw_domains(offset); \
> +	fw_engine = __fwtable_reg_read_fw_domains(offset); \
>  	if (fw_engine) \
>  		__force_wake_auto(dev_priv, fw_engine); \
>  	val = __raw_i915_read##x(dev_priv, reg); \

I notice you in later patch remove the now equal funcs.

> @@ -1829,18 +1813,18 @@ intel_uncore_forcewake_for_read(struct drm_i915_private *dev_priv,
>  
>  	switch (INTEL_GEN(dev_priv)) {
>  	case 9:
> -		fw_domains = __gen9_reg_read_fw_domains(i915_mmio_reg_offset(reg));
> +		fw_domains = __fwtable_reg_read_fw_domains(i915_mmio_reg_offset(reg));
>  		break;
>  	case 8:
>  		if (IS_CHERRYVIEW(dev_priv))
> -			fw_domains = __chv_reg_read_fw_domains(i915_mmio_reg_offset(reg));
> +			fw_domains = __fwtable_reg_read_fw_domains(i915_mmio_reg_offset(reg));
>  		else
>  			fw_domains = __gen6_reg_read_fw_domains(i915_mmio_reg_offset(reg));
>  		break;
>  	case 7:
>  	case 6:
>  		if (IS_VALLEYVIEW(dev_priv))
> -			fw_domains = __vlv_reg_read_fw_domains(i915_mmio_reg_offset(reg));
> +			fw_domains = __fwtable_reg_read_fw_domains(i915_mmio_reg_offset(reg));
>  		else
>  			fw_domains = __gen6_reg_read_fw_domains(i915_mmio_reg_offset(reg));
>  		break;

Drop the whole switch, just do if (IS_CHERRYVIEW || IS_VALLEYVIEW)
fwtable_ else gen6_. Maybe some HAS_FWTABLE() prop would work too, but
that's not must.

With switch removed,

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

Regards, Joonas
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c
index 2197c0a43dda..a4ce3576f8d4 100644
--- a/drivers/gpu/drm/i915/intel_uncore.c
+++ b/drivers/gpu/drm/i915/intel_uncore.c
@@ -648,7 +648,7 @@  static const struct intel_forcewake_range __vlv_fw_ranges[] = {
 	GEN_FW_RANGE(0x30000, 0x3ffff, FORCEWAKE_MEDIA),
 };
 
-#define __vlv_reg_read_fw_domains(offset) \
+#define __fwtable_reg_read_fw_domains(offset) \
 ({ \
 	enum forcewake_domains __fwd = 0; \
 	if (NEEDS_FORCE_WAKE((offset))) \
@@ -706,14 +706,6 @@  static const struct intel_forcewake_range __chv_fw_ranges[] = {
 	GEN_FW_RANGE(0x30000, 0x37fff, FORCEWAKE_MEDIA),
 };
 
-#define __chv_reg_read_fw_domains(offset) \
-({ \
-	enum forcewake_domains __fwd = 0; \
-	if (NEEDS_FORCE_WAKE((offset))) \
-		__fwd = find_fw_domain(dev_priv, offset); \
-	__fwd; \
-})
-
 #define __chv_reg_write_fw_domains(offset) \
 ({ \
 	enum forcewake_domains __fwd = 0; \
@@ -758,14 +750,6 @@  static const struct intel_forcewake_range __gen9_fw_ranges[] = {
 	GEN_FW_RANGE(0x30000, 0x3ffff, FORCEWAKE_MEDIA),
 };
 
-#define __gen9_reg_read_fw_domains(offset) \
-({ \
-	enum forcewake_domains __fwd = 0; \
-	if (NEEDS_FORCE_WAKE((offset))) \
-		__fwd = find_fw_domain(dev_priv, offset); \
-	__fwd; \
-})
-
 static const i915_reg_t gen9_shadowed_regs[] = {
 	RING_TAIL(RENDER_RING_BASE),
 	RING_TAIL(GEN6_BSD_RING_BASE),
@@ -926,7 +910,7 @@  static u##x \
 vlv_read##x(struct drm_i915_private *dev_priv, i915_reg_t reg, bool trace) { \
 	enum forcewake_domains fw_engine; \
 	GEN6_READ_HEADER(x); \
-	fw_engine = __vlv_reg_read_fw_domains(offset); \
+	fw_engine = __fwtable_reg_read_fw_domains(offset); \
 	if (fw_engine) \
 		__force_wake_auto(dev_priv, fw_engine); \
 	val = __raw_i915_read##x(dev_priv, reg); \
@@ -938,7 +922,7 @@  static u##x \
 chv_read##x(struct drm_i915_private *dev_priv, i915_reg_t reg, bool trace) { \
 	enum forcewake_domains fw_engine; \
 	GEN6_READ_HEADER(x); \
-	fw_engine = __chv_reg_read_fw_domains(offset); \
+	fw_engine = __fwtable_reg_read_fw_domains(offset); \
 	if (fw_engine) \
 		__force_wake_auto(dev_priv, fw_engine); \
 	val = __raw_i915_read##x(dev_priv, reg); \
@@ -950,7 +934,7 @@  static u##x \
 gen9_read##x(struct drm_i915_private *dev_priv, i915_reg_t reg, bool trace) { \
 	enum forcewake_domains fw_engine; \
 	GEN6_READ_HEADER(x); \
-	fw_engine = __gen9_reg_read_fw_domains(offset); \
+	fw_engine = __fwtable_reg_read_fw_domains(offset); \
 	if (fw_engine) \
 		__force_wake_auto(dev_priv, fw_engine); \
 	val = __raw_i915_read##x(dev_priv, reg); \
@@ -1829,18 +1813,18 @@  intel_uncore_forcewake_for_read(struct drm_i915_private *dev_priv,
 
 	switch (INTEL_GEN(dev_priv)) {
 	case 9:
-		fw_domains = __gen9_reg_read_fw_domains(i915_mmio_reg_offset(reg));
+		fw_domains = __fwtable_reg_read_fw_domains(i915_mmio_reg_offset(reg));
 		break;
 	case 8:
 		if (IS_CHERRYVIEW(dev_priv))
-			fw_domains = __chv_reg_read_fw_domains(i915_mmio_reg_offset(reg));
+			fw_domains = __fwtable_reg_read_fw_domains(i915_mmio_reg_offset(reg));
 		else
 			fw_domains = __gen6_reg_read_fw_domains(i915_mmio_reg_offset(reg));
 		break;
 	case 7:
 	case 6:
 		if (IS_VALLEYVIEW(dev_priv))
-			fw_domains = __vlv_reg_read_fw_domains(i915_mmio_reg_offset(reg));
+			fw_domains = __fwtable_reg_read_fw_domains(i915_mmio_reg_offset(reg));
 		else
 			fw_domains = __gen6_reg_read_fw_domains(i915_mmio_reg_offset(reg));
 		break;