drm/i915: Rename __force_wake_get to __force_wake_auto
authorChris Wilson <chris@chris-wilson.co.uk>
Thu, 24 Mar 2016 14:31:47 +0000 (14:31 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Wed, 30 Mar 2016 11:02:21 +0000 (12:02 +0100)
__force_wake_get() only acquires a temporary wakeref on forcewake that is
automatically released when a timer expires. When reading the code
again, I confused __intel_uncore_forcewake_get() for __force_wake_get()
and to my shame thought I found a bug in unbalanced wake_count handling.

I claim that if the function had been called __force_wake_auto() instead
I would not have embarrassed myself.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1458829907-26596-1-git-send-email-chris@chris-wilson.co.uk
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
drivers/gpu/drm/i915/intel_uncore.c

index 512b7faedefd9552d04ca943b07698b05b5da8e9..ac1c545436afd4d43948698f692e6087291b8c99 100644 (file)
@@ -716,8 +716,8 @@ __gen2_read(64)
        trace_i915_reg_rw(false, reg, val, sizeof(val), trace); \
        return val
 
-static inline void __force_wake_get(struct drm_i915_private *dev_priv,
-                                   enum forcewake_domains fw_domains)
+static inline void __force_wake_auto(struct drm_i915_private *dev_priv,
+                                    enum forcewake_domains fw_domains)
 {
        struct intel_uncore_forcewake_domain *domain;
        enum forcewake_domain_id id;
@@ -745,7 +745,7 @@ static u##x \
 gen6_read##x(struct drm_i915_private *dev_priv, i915_reg_t reg, bool trace) { \
        GEN6_READ_HEADER(x); \
        if (NEEDS_FORCE_WAKE(offset)) \
-               __force_wake_get(dev_priv, FORCEWAKE_RENDER); \
+               __force_wake_auto(dev_priv, FORCEWAKE_RENDER); \
        val = __raw_i915_read##x(dev_priv, reg); \
        GEN6_READ_FOOTER; \
 }
@@ -762,7 +762,7 @@ vlv_read##x(struct drm_i915_private *dev_priv, i915_reg_t reg, bool trace) { \
        else if (FORCEWAKE_VLV_MEDIA_RANGE_OFFSET(offset)) \
                fw_engine = FORCEWAKE_MEDIA; \
        if (fw_engine) \
-               __force_wake_get(dev_priv, fw_engine); \
+               __force_wake_auto(dev_priv, fw_engine); \
        val = __raw_i915_read##x(dev_priv, reg); \
        GEN6_READ_FOOTER; \
 }
@@ -781,7 +781,7 @@ chv_read##x(struct drm_i915_private *dev_priv, i915_reg_t reg, bool trace) { \
        else if (FORCEWAKE_CHV_COMMON_RANGE_OFFSET(offset)) \
                fw_engine = FORCEWAKE_RENDER | FORCEWAKE_MEDIA; \
        if (fw_engine) \
-               __force_wake_get(dev_priv, fw_engine); \
+               __force_wake_auto(dev_priv, fw_engine); \
        val = __raw_i915_read##x(dev_priv, reg); \
        GEN6_READ_FOOTER; \
 }
@@ -805,7 +805,7 @@ gen9_read##x(struct drm_i915_private *dev_priv, i915_reg_t reg, bool trace) { \
        else \
                fw_engine = FORCEWAKE_BLITTER; \
        if (fw_engine) \
-               __force_wake_get(dev_priv, fw_engine); \
+               __force_wake_auto(dev_priv, fw_engine); \
        val = __raw_i915_read##x(dev_priv, reg); \
        GEN6_READ_FOOTER; \
 }
@@ -969,7 +969,7 @@ static void \
 gen8_write##x(struct drm_i915_private *dev_priv, i915_reg_t reg, u##x val, bool trace) { \
        GEN6_WRITE_HEADER; \
        if (NEEDS_FORCE_WAKE(offset) && !is_gen8_shadowed(dev_priv, reg)) \
-               __force_wake_get(dev_priv, FORCEWAKE_RENDER); \
+               __force_wake_auto(dev_priv, FORCEWAKE_RENDER); \
        __raw_i915_write##x(dev_priv, reg, val); \
        GEN6_WRITE_FOOTER; \
 }
@@ -989,7 +989,7 @@ chv_write##x(struct drm_i915_private *dev_priv, i915_reg_t reg, u##x val, bool t
        else if (FORCEWAKE_CHV_COMMON_RANGE_OFFSET(offset)) \
                fw_engine = FORCEWAKE_RENDER | FORCEWAKE_MEDIA; \
        if (fw_engine) \
-               __force_wake_get(dev_priv, fw_engine); \
+               __force_wake_auto(dev_priv, fw_engine); \
        __raw_i915_write##x(dev_priv, reg, val); \
        GEN6_WRITE_FOOTER; \
 }
@@ -1036,7 +1036,7 @@ gen9_write##x(struct drm_i915_private *dev_priv, i915_reg_t reg, u##x val, \
        else \
                fw_engine = FORCEWAKE_BLITTER; \
        if (fw_engine) \
-               __force_wake_get(dev_priv, fw_engine); \
+               __force_wake_auto(dev_priv, fw_engine); \
        __raw_i915_write##x(dev_priv, reg, val); \
        GEN6_WRITE_FOOTER; \
 }