path: root/include/linux/of_platform.h
diff options
authorPawel Moll <>2014-05-15 16:55:24 +0100
committerPawel Moll <>2014-05-15 17:02:14 +0100
commitc6e126de43e7d4abfd6cf796b40589db3a046167 (patch)
tree78db63df172516da22235bed2c30544a69fc20bd /include/linux/of_platform.h
parentd6d211db37e75de2ddc3a4f979038c40df7cc79c (diff)
of: Keep track of populated platform devices
In "Device Tree powered" systems, platform devices are usually massively populated with of_platform_populate() call, executed at some level of initcalls, either by generic architecture or by platform-specific code. There are situations though where certain devices must be created (and bound with drivers) before all the others. This presents a challenge, as devices created explicitly would be created again by of_platform_populate(). This patch tries to solve that issue in a generic way, adding a "populated" flag for a DT node description. Subsequent of_platform_populate() will skip such nodes (and its children) in a similar way to the non-available ones. This patch also adds of_platform_depopulate() as an operation complementary to the _populate() one. It removes a platform or an amba device populated from the Device Tree, together with its all children (leaving, however, devices without associated of_node untouched) clearing the "populated" flag on the way. Signed-off-by: Pawel Moll <> Reviewed-by: Rob Herring <> Acked-by: Grant Likely <>
Diffstat (limited to 'include/linux/of_platform.h')
1 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
index 05cb4a928252..b1010eeaac0d 100644
--- a/include/linux/of_platform.h
+++ b/include/linux/of_platform.h
@@ -72,6 +72,7 @@ extern int of_platform_populate(struct device_node *root,
const struct of_device_id *matches,
const struct of_dev_auxdata *lookup,
struct device *parent);
+extern int of_platform_depopulate(struct device *parent);
static inline int of_platform_populate(struct device_node *root,
const struct of_device_id *matches,
@@ -80,6 +81,10 @@ static inline int of_platform_populate(struct device_node *root,
return -ENODEV;
+static inline int of_platform_depopulate(struct device *parent)
+ return -ENODEV;
#endif /* _LINUX_OF_PLATFORM_H */