@@ -122,3 +122,8 @@ static __init int of_pci_phb_init(void)
device_initcall(of_pci_phb_init);
#endif /* CONFIG_PPC_OF_PLATFORM_PCI */
+
+bool __init arch_want_default_of_probe(void)
+{
+ return false;
+}
@@ -497,12 +497,16 @@ int of_platform_default_populate(struct device_node *root,
}
EXPORT_SYMBOL_GPL(of_platform_default_populate);
-#ifndef CONFIG_PPC
+bool __init __weak arch_want_default_of_probe(void)
+{
+ return true;
+}
+
static int __init of_platform_default_populate_init(void)
{
struct device_node *node;
- if (!of_have_populated_dt())
+ if (!arch_want_default_of_probe() || !of_have_populated_dt())
return -ENODEV;
/*
@@ -522,7 +526,6 @@ static int __init of_platform_default_populate_init(void)
return 0;
}
arch_initcall_sync(of_platform_default_populate_init);
-#endif
static int of_platform_device_destroy(struct device *dev, void *data)
{
@@ -76,6 +76,7 @@ extern int of_platform_default_populate(struct device_node *root,
const struct of_dev_auxdata *lookup,
struct device *parent);
extern void of_platform_depopulate(struct device *parent);
+extern bool arch_want_default_of_probe(void);
#else
static inline int of_platform_populate(struct device_node *root,
const struct of_device_id *matches,
In commit fc520f8b4fa3 ("of/platform: disable the of_platform_default_populate_init() for all the ppc boards"), we disable the default of probe for ppc in order to fix some broken boards. But we do want to leverage the default of probe function on ppc arch. So introduce a weak function arch_want_default_of_probe(), we can override it in arch specific code to enable/disable the default of probe per board. Signed-off-by: Kevin Hao <haokexin@gmail.com> --- arch/powerpc/kernel/of_platform.c | 5 +++++ drivers/of/platform.c | 9 ++++++--- include/linux/of_platform.h | 1 + 3 files changed, 12 insertions(+), 3 deletions(-)