[Intel-gfx] [PATCH v3 5/5] drm/i915: Simplify intel_engine_wakeup()

Chris Wilson chris at chris-wilson.co.uk
Fri Feb 24 18:01:49 UTC 2017


Now the only use of the return value is ask whether or not we actually
woke a process up. With a single condition to report, we can go back to
using a boolean.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
Cc: Mika Kuoppala <mika.kuoppala at linux.intel.com>
---
 drivers/gpu/drm/i915/intel_breadcrumbs.c | 13 +++++--------
 drivers/gpu/drm/i915/intel_ringbuffer.h  |  4 +---
 2 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_breadcrumbs.c b/drivers/gpu/drm/i915/intel_breadcrumbs.c
index 8e83be343057..84034ee827af 100644
--- a/drivers/gpu/drm/i915/intel_breadcrumbs.c
+++ b/drivers/gpu/drm/i915/intel_breadcrumbs.c
@@ -26,19 +26,16 @@
 
 #include "i915_drv.h"
 
-unsigned int intel_engine_wakeup(struct intel_engine_cs *engine)
+bool intel_engine_wakeup(struct intel_engine_cs *engine)
 {
 	struct intel_wait *wait;
 	unsigned long flags;
-	unsigned int ret = 0;
+	bool ret = false;
 
 	spin_lock_irqsave(&engine->breadcrumbs.lock, flags);
 	wait = engine->breadcrumbs.first_wait;
-	if (wait) {
-		ret = ENGINE_WAKEUP_WAITER;
-		if (wake_up_process(wait->tsk))
-			ret |= ENGINE_WAKEUP_ASLEEP;
-	}
+	if (wait && wake_up_process(wait->tsk))
+		ret = true;
 	spin_unlock_irqrestore(&engine->breadcrumbs.lock, flags);
 
 	return ret;
@@ -67,7 +64,7 @@ static void intel_breadcrumbs_hangcheck(unsigned long data)
 	 * to process the pending interrupt (e.g, low priority task on a loaded
 	 * system) and wait until it sleeps before declaring a missed interrupt.
 	 */
-	if (!(intel_engine_wakeup(engine) & ENGINE_WAKEUP_ASLEEP)) {
+	if (!intel_engine_wakeup(engine)) {
 		mod_timer(&b->hangcheck, wait_timeout());
 		return;
 	}
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h
index 3dd6eee4a08b..007628231ec3 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.h
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.h
@@ -642,9 +642,7 @@ static inline bool intel_engine_has_waiter(const struct intel_engine_cs *engine)
 	return READ_ONCE(engine->breadcrumbs.first_wait);
 }
 
-unsigned int intel_engine_wakeup(struct intel_engine_cs *engine);
-#define ENGINE_WAKEUP_WAITER BIT(0)
-#define ENGINE_WAKEUP_ASLEEP BIT(1)
+bool intel_engine_wakeup(struct intel_engine_cs *engine);
 
 void __intel_engine_disarm_breadcrumbs(struct intel_engine_cs *engine);
 void intel_engine_disarm_breadcrumbs(struct intel_engine_cs *engine);
-- 
2.11.0



More information about the Intel-gfx mailing list