From: Kaitao Cheng <[email protected]> A later change will make list_for_each_entry() cache the next element before entering the loop body. __i915_schedule() builds its DFS work list while walking it by moving newly discovered dependencies to the tail.
Keep the DFS walk open-coded so the next dependency is resolved after any tail moves performed by the body. This preserves the existing traversal semantics and prepares the code for the list iterator update. Signed-off-by: Kaitao Cheng <[email protected]> --- drivers/gpu/drm/i915/i915_scheduler.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_scheduler.c b/drivers/gpu/drm/i915/i915_scheduler.c index aec1342402ca..da1f60282df8 100644 --- a/drivers/gpu/drm/i915/i915_scheduler.c +++ b/drivers/gpu/drm/i915/i915_scheduler.c @@ -190,7 +190,9 @@ static void __i915_schedule(struct i915_sched_node *node, * end result is a topological list of requests in reverse order, the * last element in the list is the request we must execute first. */ - list_for_each_entry(dep, &dfs, dfs_link) { + for (dep = list_first_entry(&dfs, typeof(*dep), dfs_link); + !list_entry_is_head(dep, &dfs, dfs_link); + dep = list_next_entry(dep, dfs_link)) { struct i915_sched_node *node = dep->signaler; /* If we are already flying, we know we have no signalers */ -- 2.43.0
