drm/i915: Rename intel_wakeref_[is]_active
authorChris Wilson <chris@chris-wilson.co.uk>
Tue, 25 Jun 2019 13:01:14 +0000 (14:01 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Tue, 25 Jun 2019 19:17:22 +0000 (20:17 +0100)
Our general rule is to use is/has as the verb for boolean functions,
rename intel_wakeref_active to intel_wakeref_is_active so the question
being asked is clear.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190625130128.11009-6-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/gem/i915_gem_pm.c
drivers/gpu/drm/i915/gt/intel_engine_cs.c
drivers/gpu/drm/i915/gt/intel_engine_pm.h
drivers/gpu/drm/i915/gt/intel_lrc.c
drivers/gpu/drm/i915/gt/intel_reset.c
drivers/gpu/drm/i915/intel_wakeref.h

index ee1f66594a35154ab71f964e89a3133b4953d2f9..6b730bd4d72fb80d3d3f7cc8c2f0262a82cdf60f 100644 (file)
@@ -54,7 +54,8 @@ static void idle_work_handler(struct work_struct *work)
        mutex_lock(&i915->drm.struct_mutex);
 
        intel_wakeref_lock(&i915->gt.wakeref);
-       park = !intel_wakeref_active(&i915->gt.wakeref) && !work_pending(work);
+       park = (!intel_wakeref_is_active(&i915->gt.wakeref) &&
+               !work_pending(work));
        intel_wakeref_unlock(&i915->gt.wakeref);
        if (park)
                i915_gem_park(i915);
index 4961f74fd90288da55e2dfefdf02b3a5b68f4f23..d1508f0b4c84e4b3ef4ba0eaac253ff18012ca48 100644 (file)
@@ -1155,7 +1155,7 @@ bool intel_engine_is_idle(struct intel_engine_cs *engine)
        if (i915_reset_failed(engine->i915))
                return true;
 
-       if (!intel_wakeref_active(&engine->wakeref))
+       if (!intel_engine_pm_is_awake(engine))
                return true;
 
        /* Waiting to drain ELSP? */
index b326cd993d60f23008abe85fe640160a23203a76..f3f5b031b4a1b127d72a6a97c115351f7264ede4 100644 (file)
@@ -7,12 +7,21 @@
 #ifndef INTEL_ENGINE_PM_H
 #define INTEL_ENGINE_PM_H
 
+#include "intel_engine_types.h"
+#include "intel_wakeref.h"
+
 struct drm_i915_private;
 struct intel_engine_cs;
 
 void intel_engine_pm_get(struct intel_engine_cs *engine);
 void intel_engine_pm_put(struct intel_engine_cs *engine);
 
+static inline bool
+intel_engine_pm_is_awake(const struct intel_engine_cs *engine)
+{
+       return intel_wakeref_is_active(&engine->wakeref);
+}
+
 void intel_engine_park(struct intel_engine_cs *engine);
 
 void intel_engine_init__pm(struct intel_engine_cs *engine);
index 22afd2616d7ff90821c44322991b05b1412539e0..471e134de186980fcaeb41e69eaad01884866dd6 100644 (file)
@@ -684,7 +684,7 @@ static void execlists_submit_ports(struct intel_engine_cs *engine)
         * that all ELSP are drained i.e. we have processed the CSB,
         * before allowing ourselves to idle and calling intel_runtime_pm_put().
         */
-       GEM_BUG_ON(!intel_wakeref_active(&engine->wakeref));
+       GEM_BUG_ON(!intel_engine_pm_is_awake(engine));
 
        /*
         * ELSQ note: the submit queue is not cleared after being submitted
index e92054e118cc4627354c703dbefca25c8c0eee78..8ce92c51564ef75ab8f83a90b1f0462fc94393e3 100644 (file)
@@ -1072,7 +1072,7 @@ int i915_reset_engine(struct intel_engine_cs *engine, const char *msg)
        GEM_TRACE("%s flags=%lx\n", engine->name, error->flags);
        GEM_BUG_ON(!test_bit(I915_RESET_ENGINE + engine->id, &error->flags));
 
-       if (!intel_wakeref_active(&engine->wakeref))
+       if (!intel_engine_pm_is_awake(engine))
                return 0;
 
        reset_prepare_engine(engine);
index d45e78639dc42636c5a2df4ddb4b1486038eef3f..f74272770a5c011704e5849a238f87bd82867393 100644 (file)
@@ -128,13 +128,13 @@ intel_wakeref_unlock(struct intel_wakeref *wf)
 }
 
 /**
- * intel_wakeref_active: Query whether the wakeref is currently held
+ * intel_wakeref_is_active: Query whether the wakeref is currently held
  * @wf: the wakeref
  *
  * Returns: true if the wakeref is currently held.
  */
 static inline bool
-intel_wakeref_active(struct intel_wakeref *wf)
+intel_wakeref_is_active(const struct intel_wakeref *wf)
 {
        return READ_ONCE(wf->wakeref);
 }