diff options
author | Grant Likely <grant.likely@linaro.org> | 2014-11-19 17:35:39 -0500 |
---|---|---|
committer | Grant Likely <grant.likely@linaro.org> | 2014-11-20 05:51:18 -0500 |
commit | 2d0747c4b68be8eb8ccfa2c538f2f5dd2ea89094 (patch) | |
tree | a52d97a377369b58a018488a15d700652bec6e74 /drivers/of | |
parent | 08d53aa58cb162e65e25dbe31d28438657cb8e33 (diff) |
of: Properly set the OF_POPULATED_BUS flag on root node
of_platform_populate() takes a subset of the device tree and turns it
into a set of platform_devices. At the same time it sets the
OF_POPULATED_BUS flag in each bus nodes so that of_platform_depopulate()
can undo the operation at a later time. However, it doesn't set the flag
on the root of the population tree which means that dynamic modifications
of the device tree at runtime will not create/destroy devices correctly.
Fix of_platform_populate() to set the OF_POPULATED_BUS flag on the node
it is called with.
Signed-off-by: Grant Likely <grant.likely@linaro.org>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Cc: Pawel Moll <pawel.moll@arm.com>
Diffstat (limited to 'drivers/of')
-rw-r--r-- | drivers/of/platform.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/of/platform.c b/drivers/of/platform.c index 7c6771986c06..656cccf0e680 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c | |||
@@ -500,6 +500,7 @@ int of_platform_populate(struct device_node *root, | |||
500 | if (rc) | 500 | if (rc) |
501 | break; | 501 | break; |
502 | } | 502 | } |
503 | of_node_set_flag(root, OF_POPULATED_BUS); | ||
503 | 504 | ||
504 | of_node_put(root); | 505 | of_node_put(root); |
505 | return rc; | 506 | return rc; |
@@ -542,7 +543,10 @@ static int of_platform_device_destroy(struct device *dev, void *data) | |||
542 | */ | 543 | */ |
543 | void of_platform_depopulate(struct device *parent) | 544 | void of_platform_depopulate(struct device *parent) |
544 | { | 545 | { |
545 | device_for_each_child(parent, NULL, of_platform_device_destroy); | 546 | if (parent->of_node && of_node_check_flag(parent->of_node, OF_POPULATED_BUS)) { |
547 | device_for_each_child(parent, NULL, of_platform_device_destroy); | ||
548 | of_node_clear_flag(parent->of_node, OF_POPULATED_BUS); | ||
549 | } | ||
546 | } | 550 | } |
547 | EXPORT_SYMBOL_GPL(of_platform_depopulate); | 551 | EXPORT_SYMBOL_GPL(of_platform_depopulate); |
548 | 552 | ||