diff options
author | Javier Martinez Canillas <javier.martinez@collabora.co.uk> | 2013-04-17 16:34:11 -0400 |
---|---|---|
committer | Jon Hunter <jon-hunter@ti.com> | 2013-04-30 09:43:04 -0400 |
commit | f2b09f67047aa5da60718f1a92e9b7f26b9266b4 (patch) | |
tree | cc110e87707e6883a2f4ea34c93cf93dba7d233d /arch/arm/mach-omap2 | |
parent | c059e0288c3875e0e9356e47b8477c2c74d72007 (diff) |
ARM: OMAP2+: only search for GPMC DT child nodes on probe
The GPMC DT probe function use for_each_node_by_name() to search
child device nodes of the GPMC controller. But this function does
not use the GPMC device node as the root of the search and instead
search across the complete Device Tree.
This means that any device node on the DT that is using any of the
GPMC child nodes names searched for will be returned even if they
are not connected to the GPMC, making the gpmc_probe_xxx_child()
function to fail.
Fix this by using the GPMC device node as the search root so the
search will be restricted to its children.
Reported-by: Lars Poeschel <poeschel@lemonage.de>
Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Signed-off-by: Jon Hunter <jon-hunter@ti.com>
Diffstat (limited to 'arch/arm/mach-omap2')
-rw-r--r-- | arch/arm/mach-omap2/gpmc.c | 33 |
1 files changed, 10 insertions, 23 deletions
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c index ed946df5ad8a..6166847a3244 100644 --- a/arch/arm/mach-omap2/gpmc.c +++ b/arch/arm/mach-omap2/gpmc.c | |||
@@ -1520,32 +1520,19 @@ static int gpmc_probe_dt(struct platform_device *pdev) | |||
1520 | return ret; | 1520 | return ret; |
1521 | } | 1521 | } |
1522 | 1522 | ||
1523 | for_each_node_by_name(child, "nand") { | 1523 | for_each_child_of_node(pdev->dev.of_node, child) { |
1524 | ret = gpmc_probe_nand_child(pdev, child); | ||
1525 | if (ret < 0) { | ||
1526 | of_node_put(child); | ||
1527 | return ret; | ||
1528 | } | ||
1529 | } | ||
1530 | 1524 | ||
1531 | for_each_node_by_name(child, "onenand") { | 1525 | if (!child->name) |
1532 | ret = gpmc_probe_onenand_child(pdev, child); | 1526 | continue; |
1533 | if (ret < 0) { | ||
1534 | of_node_put(child); | ||
1535 | return ret; | ||
1536 | } | ||
1537 | } | ||
1538 | 1527 | ||
1539 | for_each_node_by_name(child, "nor") { | 1528 | if (of_node_cmp(child->name, "nand") == 0) |
1540 | ret = gpmc_probe_generic_child(pdev, child); | 1529 | ret = gpmc_probe_nand_child(pdev, child); |
1541 | if (ret < 0) { | 1530 | else if (of_node_cmp(child->name, "onenand") == 0) |
1542 | of_node_put(child); | 1531 | ret = gpmc_probe_onenand_child(pdev, child); |
1543 | return ret; | 1532 | else if (of_node_cmp(child->name, "ethernet") == 0 || |
1544 | } | 1533 | of_node_cmp(child->name, "nor") == 0) |
1545 | } | 1534 | ret = gpmc_probe_generic_child(pdev, child); |
1546 | 1535 | ||
1547 | for_each_node_by_name(child, "ethernet") { | ||
1548 | ret = gpmc_probe_generic_child(pdev, child); | ||
1549 | if (ret < 0) { | 1536 | if (ret < 0) { |
1550 | of_node_put(child); | 1537 | of_node_put(child); |
1551 | return ret; | 1538 | return ret; |