of: make PowerMac cache node search conditional on CONFIG_PPC_PMAC
authorRob Herring <robh@kernel.org>
Mon, 27 Aug 2018 14:50:09 +0000 (09:50 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Nov 2019 16:59:48 +0000 (17:59 +0100)
[ Upstream commit f6707fd6241e483f6fea2caae82d876e422bb11a ]

Cache nodes under the cpu node(s) is PowerMac specific according to the
comment above, so make the code enforce that.

Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/of/base.c

index ce8a6e0c9b6a955fa5ba7ac8e6f8fe3312b954f1..41b254be02954b6426c7c832e0f9cc2d0a5c082e 100644 (file)
@@ -1837,7 +1837,7 @@ struct device_node *of_find_next_cache_node(const struct device_node *np)
        /* OF on pmac has nodes instead of properties named "l2-cache"
         * beneath CPU nodes.
         */
-       if (!strcmp(np->type, "cpu"))
+       if (IS_ENABLED(CONFIG_PPC_PMAC) && !strcmp(np->type, "cpu"))
                for_each_child_of_node(np, child)
                        if (!strcmp(child->type, "cache"))
                                return child;