[POWERPC] 52xx: Don't use device_initcall to probe of_platform_bus
authorSylvain Munaut <tnt@246tNt.com>
Tue, 2 Jan 2007 22:29:53 +0000 (23:29 +0100)
committerPaul Mackerras <paulus@samba.org>
Tue, 9 Jan 2007 06:03:02 +0000 (17:03 +1100)
Using device_initcall makes it happen for every platform that
compiles this file in. This is really bad, for obvious reasons.

Instead, we use the .init field of the machine description. If
the platform needs the hook to do something specific it can provides
its own function and call mpc52xx_declare_of_platform_devices from
there. If not, the mpc52xx_declare_of_platform_devices function can
directly be used as the init hook.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/platforms/52xx/lite5200.c
arch/powerpc/platforms/52xx/mpc52xx_common.c
include/asm-powerpc/mpc52xx.h

index eaff71e74fb0f8a783465715f73560c877a81c69..0f21bab33f6ce31f7006f487e5b55467fb7d4ff2 100644 (file)
@@ -153,6 +153,7 @@ define_machine(lite52xx) {
        .name           = "lite52xx",
        .probe          = lite52xx_probe,
        .setup_arch     = lite52xx_setup_arch,
+       .init           = mpc52xx_declare_of_platform_devices,
        .init_IRQ       = mpc52xx_init_irq,
        .get_irq        = mpc52xx_get_irq,
        .show_cpuinfo   = lite52xx_show_cpuinfo,
index 8331ff457770dde2063e5571fdae04baba19aaca..cc40889074bd1f6c88e07a619f40186a047546d3 100644 (file)
@@ -116,11 +116,12 @@ unmap_regs:
        if (xlb) iounmap(xlb);
 }
 
-static int __init
+void __init
 mpc52xx_declare_of_platform_devices(void)
 {
        /* Find every child of the SOC node and add it to of_platform */
-       return of_platform_bus_probe(NULL, NULL, NULL);
+       if (of_platform_bus_probe(NULL, NULL, NULL))
+               printk(KERN_ERR __FILE__ ": "
+                       "Error while probing of_platform bus\n");
 }
 
-device_initcall(mpc52xx_declare_of_platform_devices);
index 4a28a850998c052bdd88ce597d5e2d33d064a4e3..4560d72fc75875ecd547a6e33a67131c83646228 100644 (file)
@@ -244,6 +244,7 @@ struct mpc52xx_cdm {
 extern void __iomem * mpc52xx_find_and_map(const char *);
 extern unsigned int mpc52xx_find_ipb_freq(struct device_node *node);
 extern void mpc52xx_setup_cpu(void);
+extern void mpc52xx_declare_of_platform_devices(void);
 
 extern void mpc52xx_init_irq(void);
 extern unsigned int mpc52xx_get_irq(void);