|
@@ -500,6 +500,7 @@ int of_platform_populate(struct device_node *root,
|
|
|
if (rc)
|
|
|
break;
|
|
|
}
|
|
|
+ of_node_set_flag(root, OF_POPULATED_BUS);
|
|
|
|
|
|
of_node_put(root);
|
|
|
return rc;
|
|
@@ -542,7 +543,10 @@ static int of_platform_device_destroy(struct device *dev, void *data)
|
|
|
*/
|
|
|
void of_platform_depopulate(struct device *parent)
|
|
|
{
|
|
|
- device_for_each_child(parent, NULL, of_platform_device_destroy);
|
|
|
+ if (parent->of_node && of_node_check_flag(parent->of_node, OF_POPULATED_BUS)) {
|
|
|
+ device_for_each_child(parent, NULL, of_platform_device_destroy);
|
|
|
+ of_node_clear_flag(parent->of_node, OF_POPULATED_BUS);
|
|
|
+ }
|
|
|
}
|
|
|
EXPORT_SYMBOL_GPL(of_platform_depopulate);
|
|
|
|