drm/i915: Do not rely on for loop caching the mask
diff mbox series

Message ID 20190725125056.11942-1-tvrtko.ursulin@linux.intel.com
State New
Headers show
Series
  • drm/i915: Do not rely on for loop caching the mask
Related show

Commit Message

Tvrtko Ursulin July 25, 2019, 12:50 p.m. UTC
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

for_each_engine_masked caches the engine mask but what does the caller
know.

Cache it explicitly for clarity and while at it correct the type to match.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_active.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Chris Wilson July 25, 2019, 1:15 p.m. UTC | #1
Quoting Tvrtko Ursulin (2019-07-25 13:50:56)
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> 
> for_each_engine_masked caches the engine mask but what does the caller
> know.
> 
> Cache it explicitly for clarity and while at it correct the type to match.
> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>

Stealing all the small pleasures in life!

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris

Patch
diff mbox series

diff --git a/drivers/gpu/drm/i915/i915_active.c b/drivers/gpu/drm/i915/i915_active.c
index 13f304a29fc8..9083634a9027 100644
--- a/drivers/gpu/drm/i915/i915_active.c
+++ b/drivers/gpu/drm/i915/i915_active.c
@@ -346,12 +346,12 @@  int i915_active_acquire_preallocate_barrier(struct i915_active *ref,
 					    struct intel_engine_cs *engine)
 {
 	struct drm_i915_private *i915 = engine->i915;
+	intel_engine_mask_t tmp, mask = engine->mask;
 	struct llist_node *pos, *next;
-	unsigned long tmp;
 	int err;
 
-	GEM_BUG_ON(!engine->mask);
-	for_each_engine_masked(engine, i915, engine->mask, tmp) {
+	GEM_BUG_ON(!mask);
+	for_each_engine_masked(engine, i915, mask, tmp) {
 		struct intel_context *kctx = engine->kernel_context;
 		struct active_node *node;