]> git.baikalelectronics.ru Git - kernel.git/commit
of: introduce for_each_matching_node_and_match()
authorStephen Warren <swarren@nvidia.com>
Tue, 20 Nov 2012 23:12:20 +0000 (16:12 -0700)
committerRob Herring <rob.herring@calxeda.com>
Wed, 21 Nov 2012 04:58:55 +0000 (22:58 -0600)
commitb13934367f84f3147123e7d7e7db8fc54ee78981
tree9690d810d1eef4b5dc8a26824dc699bbb4d54f44
parent5fa3fb7b8317a6ee8ad5e49b004b5cdf93864293
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: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Rob Herring <rob.herring@calxeda.com>
drivers/of/base.c
include/linux/of.h