Skip to content
Commit 50c8af4c authored by Stephen Warren's avatar Stephen Warren Committed by Rob Herring
Browse files

of: introduce for_each_matching_node_and_match()



The following pattern of code is tempting:

    for_each_matching_node(np, table) {
        match = of_match_node(table, np);

However, this results in iterating over table twice; the second time
inside of_match_node(). The implementation of for_each_matching_node()
already found the match, so this is redundant. Invent new function
of_find_matching_node_and_match() and macro
for_each_matching_node_and_match() to remove the double iteration,
thus transforming the above code to:

    for_each_matching_node_and_match(np, table, &match)

Signed-off-by: default avatarStephen Warren <swarren@nvidia.com>
Signed-off-by: default avatarRob Herring <rob.herring@calxeda.com>
parent be193249
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment