Skip to contentSkip to conversation

MIPS: Clean-up DT bus probing

PATCH In review Rob Herring 2 participants 7 messages Jun 19, 2018 – Jun 20, 2018

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover MIPS: Clean-up DT bus probing

This is a series of clean-ups of DT bus probing calls. Generally, the DT core code takes care of the default case and arches/platforms only need to do their own call if they have non-default matching requirements.

Rob

Rob Herring (5):
MIPS: octeon: use of_platform_populate to probe devices
MIPS: netlogic: remove unnecessary of_platform_bus_probe call
MIPS: bmips: remove unnecessary call to register "simple-bus"
MIPS: generic: remove unnecessary of_platform_populate call
MIPS: lantiq: remove unnecessary of_platform_default_populate call

 arch/mips/bmips/setup.c                   |  7 -------
 arch/mips/cavium-octeon/octeon-platform.c |  2 +-
 arch/mips/generic/init.c                  | 13 -------------
 arch/mips/lantiq/prom.c                   |  8 --------
 arch/mips/netlogic/xlp/dt.c               | 14 --------------
 5 files changed, 1 insertion(+), 43 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/5 MIPS: octeon: use of_platform_populate to probe devices

of_platform_bus_probe is deprecated in favor of of_platform_populate. of_platform_populate is stricter requiring compatible properties for matching rather than name or type. Octeon uses compatible strings for matching, so convert it to of_platform_populate.

---
 arch/mips/cavium-octeon/octeon-platform.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/cavium-octeon/octeon-platform.c +1 -1
index 8505db478904..2940e9cc3a04 100644
@@ -1067,6 +1067,6 @@ int __init octeon_prune_device_tree(void)
 
 static int __init octeon_publish_devices(void)
 {
-	return of_platform_bus_probe(NULL, octeon_ids, NULL);
+	return of_platform_populate(NULL, octeon_ids, NULL, NULL);
 }
 arch_initcall(octeon_publish_devices);
Signature · 1 line
2.17.1
#2 lore raw

PATCH 2/5 MIPS: netlogic: remove unnecessary of_platform_bus_probe call

In reply to Rob Herring

The DT core code will probe "simple-bus" by default, so remove the Netlogic specific call. The probing of simple-bus happens at arch_initcall_sync, so the call being removed here is already a nop.

---
 arch/mips/netlogic/xlp/dt.c | 14 --------------
 1 file changed, 14 deletions(-)
arch/mips/netlogic/xlp/dt.c +0 -14
index 856a6e6d296e..b5ba83f4c646 100644
@@ -93,17 +93,3 @@ void __init device_tree_init(void)
 {
 	unflatten_and_copy_device_tree();
 }
-
-static struct of_device_id __initdata xlp_ids[] = {
-	{ .compatible = "simple-bus", },
-	{},
-};
-
-int __init xlp8xx_ds_publish_devices(void)
-{
-	if (!of_have_populated_dt())
-		return 0;
-	return of_platform_bus_probe(NULL, xlp_ids, NULL);
-}
-
-device_initcall(xlp8xx_ds_publish_devices);
Signature · 1 line
2.17.1
#3 lore raw

PATCH 3/5 MIPS: bmips: remove unnecessary call to register "simple-bus"

In reply to Rob Herring

The DT core will register "simple-bus" by default, so it is not necessary for arch specific code to do so unless there are custom match entries, auxdata or parent device. Neither of those apply here, so remove the call.

Cc Kevin Cernekee <[email protected]>
Cc Florian Fainelli <[email protected]>
Cc Ralf Baechle <[email protected]>
Cc Paul Burton <[email protected]>
Cc James Hogan <[email protected]>
---
 arch/mips/bmips/setup.c | 7 -------
 1 file changed, 7 deletions(-)
arch/mips/bmips/setup.c +0 -7
index 3b6f687f177c..231fc5ce375e 100644
@@ -202,13 +202,6 @@ void __init device_tree_init(void)
 	of_node_put(np);
 }
 
-int __init plat_of_setup(void)
-{
-	return __dt_register_buses("simple-bus", NULL);
-}
-
-arch_initcall(plat_of_setup);
-
 static int __init plat_dev_init(void)
 {
 	of_clk_init(NULL);
Signature · 1 line
2.17.1
#4 lore raw

PATCH 4/5 MIPS: generic: remove unnecessary of_platform_populate call

In reply to Rob Herring

The DT core will call of_platform_populate, so it is not necessary for arch specific code to call it unless there are custom match entries, auxdata or parent device. Neither of those apply here, so remove the call.

---
 arch/mips/generic/init.c | 13 -------------
 1 file changed, 13 deletions(-)
arch/mips/generic/init.c +0 -13
index 5ba6fcc26fa7..07ec08462d70 100644
@@ -14,7 +14,6 @@
 #include <linux/init.h>
 #include <linux/irqchip.h>
 #include <linux/of_fdt.h>
-#include <linux/of_platform.h>
 
 #include <asm/bootinfo.h>
 #include <asm/fw/fw.h>
@@ -208,18 +207,6 @@ void __init arch_init_irq(void)
 	irqchip_init();
 }
 
-static int __init publish_devices(void)
-{
-	if (!of_have_populated_dt())
-		panic("Device-tree not present");
-
-	if (of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL))
-		panic("Failed to populate DT");
-
-	return 0;
-}
-arch_initcall(publish_devices);
-
 void __init prom_free_prom_memory(void)
 {
 }
Signature · 1 line
2.17.1
#5 lore raw

PATCH 5/5 MIPS: lantiq: remove unnecessary of_platform_default_populate call

In reply to Rob Herring

The DT core will call of_platform_default_populate, so it is not necessary for arch specific code to call it unless there are custom match entries, auxdata or parent device. Neither of those apply here, so remove the call.

Cc John Crispin <[email protected]>
Cc Ralf Baechle <[email protected]>
Cc Paul Burton <[email protected]>
Cc James Hogan <[email protected]>
---
 arch/mips/lantiq/prom.c | 8 --------
 1 file changed, 8 deletions(-)
arch/mips/lantiq/prom.c +0 -8
index 9ff7ccde9de0..d984bd5c2ec5 100644
@@ -9,7 +9,6 @@
 #include <linux/export.h>
 #include <linux/clk.h>
 #include <linux/bootmem.h>
-#include <linux/of_platform.h>
 #include <linux/of_fdt.h>
 
 #include <asm/bootinfo.h>
@@ -114,10 +113,3 @@ void __init prom_init(void)
 		panic("failed to register_vsmp_smp_ops()");
 #endif
 }
-
-int __init plat_of_setup(void)
-{
-	return of_platform_default_populate(NULL, NULL, NULL);
-}
-
-arch_initcall(plat_of_setup);
Signature · 1 line
2.17.1
#6 lore raw
In reply to Rob Herring

Hi Rob,

Quoted 14 lines · Rob Herring

This is a series of clean-ups of DT bus probing calls. Generally, the DT core code takes care of the default case and arches/platforms only need to do their own call if they have non-default matching requirements.

Rob

Rob Herring (5):
MIPS: octeon: use of_platform_populate to probe devices
MIPS: netlogic: remove unnecessary of_platform_bus_probe call
MIPS: bmips: remove unnecessary call to register "simple-bus"
MIPS: generic: remove unnecessary of_platform_populate call
MIPS: lantiq: remove unnecessary of_platform_default_populate call

Quoted 6 lines
 arch/mips/bmips/setup.c                   |  7 -------
 arch/mips/cavium-octeon/octeon-platform.c |  2 +-
 arch/mips/generic/init.c                  | 13 -------------
 arch/mips/lantiq/prom.c                   |  8 --------
 arch/mips/netlogic/xlp/dt.c               | 14 --------------
 5 files changed, 1 insertion(+), 43 deletions(-)

Thanks - series applied to mips-next for 4.19.

Paul