Add machine initcall macros
Subsystems (6)
PATCH v2 1/2 Add machine initcall macros
From: Grant Likely <[email protected]>
The machine initcall macros allow initcalls to be registered which test machine_is() before executing the initcall.
---
include/asm-powerpc/machdep.h | 23 +++++++++++++++++++++++ 1 files changed, 23 insertions(+), 0 deletions(-)
include/asm-powerpc/machdep.h +23 -0
@@ -326,5 +326,28 @@ static inline void log_error(char *buf, unsigned int err_type, int fatal) ppc_md.log_error (buf, err_type, fatal); } +#define __define_machine_initcall (mach,level,fn,id) \ + static int __init __machine_initcall_##mach##_##fn(void) { \ + if (machine_is(mach)) return fn(); \ + return 0; \ + } \ + __define_initcall(level,__machine_initcall_##mach##_##fn,id); + +#define machine_core_initcall (mach,fn) __define_machine_initcall(mach,"1",fn,1) +#define machine_core_initcall_sync (mach,fn) __define_machine_initcall(mach,"1s",fn,1s) +#define machine_postcore_initcall (mach,fn) __define_machine_initcall(mach,"2",fn,2) +#define machine_postcore_initcall_sync (mach,fn) __define_machine_initcall(mach,"2s",fn,2s) +#define machine_arch_initcall (mach,fn) __define_machine_initcall(mach,"3",fn,3) +#define machine_arch_initcall_sync (mach,fn) __define_machine_initcall(mach,"3s",fn,3s) +#define machine_subsys_initcall (mach,fn) __define_machine_initcall(mach,"4",fn,4) +#define machine_subsys_initcall_sync (mach,fn) __define_machine_initcall(mach,"4s",fn,4s) +#define machine_fs_initcall (mach,fn) __define_machine_initcall(mach,"5",fn,5) +#define machine_fs_initcall_sync (mach,fn) __define_machine_initcall(mach,"5s",fn,5s) +#define machine_rootfs_initcall (mach,fn) __define_machine_initcall(mach,"rootfs",fn,rootfs) +#define machine_device_initcall (mach,fn) __define_machine_initcall(mach,"6",fn,6) +#define machine_device_initcall_sync (mach,fn) __define_machine_initcall(mach,"6s",fn,6s) +#define machine_late_initcall (mach,fn) __define_machine_initcall(mach,"7",fn,7) +#define machine_late_initcall_sync (mach,fn) __define_machine_initcall(mach,"7s",fn,7s) +#endif /* __KERNEL__ */ #endif /* _ASM_POWERPC_MACHDEP_H */
PATCH v2 2/2 Use new machine_xxx_initcall hooks in platform code
From: Grant Likely <[email protected]>
This patch makes the platform code use the new machine-specific initcall hooks. This has the advantage of not needing to explicitly test machine_is() at the top of every initcall function.
---
arch/powerpc/platforms/40x/kilauea.c | 5 +---- arch/powerpc/platforms/40x/virtex.c | 5 +---- arch/powerpc/platforms/40x/walnut.c | 5 +---- arch/powerpc/platforms/44x/bamboo.c | 5 +---- arch/powerpc/platforms/44x/ebony.c | 5 +---- arch/powerpc/platforms/44x/sequoia.c | 5 +---- arch/powerpc/platforms/82xx/mpc8272_ads.c | 5 +---- arch/powerpc/platforms/82xx/pq2fads.c | 5 +---- arch/powerpc/platforms/83xx/mpc832x_mds.c | 5 +---- arch/powerpc/platforms/83xx/mpc832x_rdb.c | 11 ++--------- arch/powerpc/platforms/83xx/mpc836x_mds.c | 5 +---- arch/powerpc/platforms/85xx/mpc85xx_ads.c | 5 +---- arch/powerpc/platforms/85xx/mpc85xx_cds.c | 6 +----- arch/powerpc/platforms/85xx/mpc85xx_mds.c | 5 +---- arch/powerpc/platforms/8xx/ep88xc.c | 5 ++--- arch/powerpc/platforms/8xx/mpc885ads_setup.c | 5 ++--- arch/powerpc/platforms/cell/io-workarounds.c | 5 +---- arch/powerpc/platforms/cell/iommu.c | 5 +---- arch/powerpc/platforms/cell/pmu.c | 5 +---- arch/powerpc/platforms/cell/setup.c | 5 +---- arch/powerpc/platforms/celleb/iommu.c | 6 +----- arch/powerpc/platforms/celleb/setup.c | 5 +---- arch/powerpc/platforms/embedded6xx/ls_uart.c | 5 +---- arch/powerpc/platforms/pasemi/idle.c | 5 +---- arch/powerpc/platforms/pasemi/setup.c | 10 ++-------- arch/powerpc/platforms/powermac/low_i2c.c | 7 ++----- arch/powerpc/platforms/powermac/pfunc_base.c | 3 +-- arch/powerpc/platforms/powermac/pic.c | 3 +-- arch/powerpc/platforms/powermac/setup.c | 12 ++---------- 29 files changed, 35 insertions(+), 128 deletions(-)
arch/powerpc/platforms/40x/kilauea.c +1 -4
@@ -29,14 +29,11 @@ static struct of_device_id kilauea_of_bus[] = {static int __init kilauea_device_probe (void ) { -if (!machine_is (kilauea)) -return 0 ; -of_platform_bus_probe (NULL , kilauea_of_bus,NULL );return 0 ; } -device_initcall (kilauea_device_probe); +machine_device_initcall (kilauea, kilauea_device_probe);static int __init kilauea_probe (void ) {
arch/powerpc/platforms/40x/virtex.c +1 -4
@@ -17,14 +17,11 @@static int __init virtex_device_probe (void ) { -if (!machine_is (virtex)) -return 0 ; -of_platform_bus_probe (NULL ,NULL ,NULL );return 0 ; } -device_initcall (virtex_device_probe); +machine_device_initcall (virtex, virtex_device_probe);static int __init virtex_probe (void ) {
arch/powerpc/platforms/40x/walnut.c +1 -4
@@ -34,15 +34,12 @@ static struct of_device_id walnut_of_bus[] = {static int __init walnut_device_probe (void ) { -if (!machine_is (walnut)) -return 0 ; -/* FIXME: do bus probe here */ of_platform_bus_probe (NULL , walnut_of_bus,NULL );return 0 ; } -device_initcall (walnut_device_probe); +machine_device_initcall (walnut, walnut_device_probe);static int __init walnut_probe (void ) {
arch/powerpc/platforms/44x/bamboo.c +1 -4
@@ -32,14 +32,11 @@ static struct of_device_id bamboo_of_bus[] = {static int __init bamboo_device_probe (void ) { -if (!machine_is (bamboo)) -return 0 ; -of_platform_bus_probe (NULL , bamboo_of_bus,NULL );return 0 ; } -device_initcall (bamboo_device_probe); +machine_device_initcall (bamboo, bamboo_device_probe);static int __init bamboo_probe (void ) {
arch/powerpc/platforms/44x/ebony.c +1 -4
@@ -36,14 +36,11 @@ static struct of_device_id ebony_of_bus[] = {static int __init ebony_device_probe (void ) { -if (!machine_is (ebony)) -return 0 ; -of_platform_bus_probe (NULL , ebony_of_bus,NULL );return 0 ; } -device_initcall (ebony_device_probe); +machine_device_initcall (ebony, ebony_device_probe);/* * Called very early, MMU is off, device-tree isn't unflattened
arch/powerpc/platforms/44x/sequoia.c +1 -4
@@ -32,14 +32,11 @@ static struct of_device_id sequoia_of_bus[] = {static int __init sequoia_device_probe (void ) { -if (!machine_is (sequoia)) -return 0 ; -of_platform_bus_probe (NULL , sequoia_of_bus,NULL );return 0 ; } -device_initcall (sequoia_device_probe); +machine_device_initcall (sequoia, sequoia_device_probe);static int __init sequoia_probe (void ) {
arch/powerpc/platforms/82xx/mpc8272_ads.c +1 -4
@@ -165,14 +165,11 @@ static struct of_device_id __initdata of_bus_ids[] = {static int __init declare_of_platform_devices (void ) { -if (!machine_is (mpc8272_ads)) -return 0 ; -/* Publish the QE devices */ of_platform_bus_probe (NULL , of_bus_ids,NULL );return 0 ; } -device_initcall (declare_of_platform_devices); +machine_device_initcall (mpc8272_ads, declare_of_platform_devices);/* * Called very early, device-tree isn't unflattened
arch/powerpc/platforms/82xx/pq2fads.c +1 -4
@@ -176,14 +176,11 @@ static struct of_device_id __initdata of_bus_ids[] = {static int __init declare_of_platform_devices (void ) { -if (!machine_is (pq2fads)) -return 0 ; -/* Publish the QE devices */ of_platform_bus_probe (NULL , of_bus_ids,NULL );return 0 ; } -device_initcall (declare_of_platform_devices); +machine_device_initcall (pq2fads, declare_of_platform_devices);define_machine (pq2fads) {
arch/powerpc/platforms/83xx/mpc832x_mds.c +1 -4
@@ -110,15 +110,12 @@ static struct of_device_id mpc832x_ids[] = {static int __init mpc832x_declare_of_platform_devices (void ) { -if (!machine_is (mpc832x_mds)) -return 0 ; -/* Publish the QE devices */ of_platform_bus_probe (NULL , mpc832x_ids,NULL );return 0 ; } -device_initcall (mpc832x_declare_of_platform_devices); +machine_device_initcall (mpc832x_mds, mpc832x_declare_of_platform_devices);static void __init mpc832x_sys_init_IRQ (void ) {
arch/powerpc/platforms/83xx/mpc832x_rdb.c +2 -9
@@ -63,9 +63,6 @@ static struct spi_board_info mpc832x_spi_boardinfo = {static int __init mpc832x_spi_init (void ) { -if (!machine_is (mpc832x_rdb)) -return 0 ; -par_io_config_pin (3 ,0 ,3 ,0 ,1 ,0 );/* SPI1 MOSI, I/O */ par_io_config_pin (3 ,1 ,3 ,0 ,1 ,0 );/* SPI1 MISO, I/O */ par_io_config_pin (3 ,2 ,3 ,0 ,1 ,0 );/* SPI1 CLK, I/O */
@@ -79,8 +76,7 @@ static int __init mpc832x_spi_init(void) mpc83xx_spi_activate_cs, mpc83xx_spi_deactivate_cs); } - -device_initcall (mpc832x_spi_init); +machine_device_initcall (mpc832x_rdb, mpc832x_spi_init);/* ************************************************************************ *
@@ -123,15 +119,12 @@ static struct of_device_id mpc832x_ids[] = {static int __init mpc832x_declare_of_platform_devices (void ) { -if (!machine_is (mpc832x_rdb)) -return 0 ; -/* Publish the QE devices */ of_platform_bus_probe (NULL , mpc832x_ids,NULL );return 0 ; } -device_initcall (mpc832x_declare_of_platform_devices); +machine_device_initcall (mpc832x_rdb, mpc832x_declare_of_platform_devices);void __init mpc832x_rdb_init_IRQ (void ) {
arch/powerpc/platforms/83xx/mpc836x_mds.c +1 -4
@@ -141,15 +141,12 @@ static struct of_device_id mpc836x_ids[] = {static int __init mpc836x_declare_of_platform_devices (void ) { -if (!machine_is (mpc836x_mds)) -return 0 ; -/* Publish the QE devices */ of_platform_bus_probe (NULL , mpc836x_ids,NULL );return 0 ; } -device_initcall (mpc836x_declare_of_platform_devices); +machine_device_initcall (mpc836x_mds, mpc836x_declare_of_platform_devices);static void __init mpc836x_mds_init_IRQ (void ) {
arch/powerpc/platforms/85xx/mpc85xx_ads.c +1 -4
@@ -233,13 +233,10 @@ static struct of_device_id __initdata of_bus_ids[] = {static int __init declare_of_platform_devices (void ) { -if (!machine_is (mpc85xx_ads)) -return 0 ; -of_platform_bus_probe (NULL , of_bus_ids,NULL );return 0 ; } -device_initcall (declare_of_platform_devices); +machine_device_initcall (mpc85xx_ads, declare_of_platform_devices);/* * Called very early, device-tree isn't unflattened
arch/powerpc/platforms/85xx/mpc85xx_cds.c +1 -5
@@ -222,9 +222,6 @@ static int mpc85xx_cds_8259_attach(void)struct device_node *cascade_node =NULL ;int cascade_irq; -if (!machine_is (mpc85xx_cds)) -return 0 ; -/* Initialize the i8259 controller */ for_each_node_by_type (np,"interrupt-controller" )if (of_device_is_compatible (np,"chrp,iic" )) {
@@ -262,8 +259,7 @@ static int mpc85xx_cds_8259_attach(void) return 0; } - -device_initcall (mpc85xx_cds_8259_attach); +machine_device_initcall (mpc85xx_cds, mpc85xx_cds_8259_attach);#endif /* CONFIG_PPC_I8259 */
arch/powerpc/platforms/85xx/mpc85xx_mds.c +1 -4
@@ -144,15 +144,12 @@ static struct of_device_id mpc85xx_ids[] = {static int __init mpc85xx_publish_devices (void ) { -if (!machine_is (mpc85xx_mds)) -return 0 ; -/* Publish the QE devices */ of_platform_bus_probe (NULL ,mpc85xx_ids,NULL );return 0 ; } -device_initcall (mpc85xx_publish_devices); +machine_device_initcall (mpc85xx_mds, mpc85xx_publish_devices);static void __init mpc85xx_mds_pic_init (void ) {
arch/powerpc/platforms/8xx/ep88xc.c +2 -3
@@ -155,12 +155,11 @@ static struct of_device_id __initdata of_bus_ids[] = {static int __init declare_of_platform_devices (void ) {/* Publish the QE devices */ -if (machine_is (ep88xc)) -of_platform_bus_probe (NULL , of_bus_ids,NULL ); +of_platform_bus_probe (NULL , of_bus_ids,NULL );return 0 ; } -device_initcall (declare_of_platform_devices); +machine_device_initcall (ep88xc, declare_of_platform_devices);define_machine (ep88xc) { .name = "Embedded Planet EP88xC",
arch/powerpc/platforms/8xx/mpc885ads_setup.c +2 -3
@@ -264,12 +264,11 @@ static struct of_device_id __initdata of_bus_ids[] = {static int __init declare_of_platform_devices (void ) {/* Publish the QE devices */ -if (machine_is (mpc885_ads)) -of_platform_bus_probe (NULL , of_bus_ids,NULL ); +of_platform_bus_probe (NULL , of_bus_ids,NULL );return 0 ; } -device_initcall (declare_of_platform_devices); +machine_device_initcall (mpc885_ads, declare_of_platform_devices);define_machine (mpc885_ads) { .name = "Freescale MPC885 ADS",
arch/powerpc/platforms/cell/io-workarounds.c +1 -4
@@ -309,9 +309,6 @@ static int __init spider_pci_workaround_init(void) {struct pci_controller *phb; -if (!machine_is (cell)) -return 0 ; -/* Find spider bridges. We assume they have been all probed * in setup_arch(). If that was to change, we would need to * update this code to cope with dynamically added busses
@@ -343,4 +340,4 @@ static int __init spider_pci_workaround_init(void)return 0 ; } -arch_initcall (spider_pci_workaround_init); +machine_arch_initcall (cell, spider_pci_workaround_init);
arch/powerpc/platforms/cell/iommu.c +1 -4
@@ -699,9 +699,6 @@ static int __init cell_iommu_init(void) {struct device_node *np; -if (!machine_is (cell)) -return -ENODEV ; -/* If IOMMU is disabled or we have little enough RAM to not need * to enable it, we setup a direct mapping. *
@@ -744,5 +741,5 @@ static int __init cell_iommu_init(void)return 0 ; } -arch_initcall (cell_iommu_init); +machine_arch_initcall (cell, cell_iommu_init);
arch/powerpc/platforms/cell/pmu.c +1 -4
@@ -381,9 +381,6 @@ static int __init cbe_init_pm_irq(void)unsigned int irq;int rc, node; -if (!machine_is (cell)) -return 0 ; -for_each_node (node) { irq =irq_create_mapping (NULL ,IIC_IRQ_IOEX_PMI | (node <<IIC_IRQ_NODE_SHIFT ));
@@ -404,7 +401,7 @@ static int __init cbe_init_pm_irq(void)return 0 ; } -arch_initcall (cbe_init_pm_irq); +machine_arch_initcall (cell, cbe_init_pm_irq);void cbe_sync_irq (int node) {
arch/powerpc/platforms/cell/setup.c +1 -4
@@ -85,9 +85,6 @@ static int __init cell_publish_devices(void) {int node; -if (!machine_is (cell)) -return 0 ; -/* Publish OF platform devices for southbridge IOs */ of_platform_bus_probe (NULL ,NULL ,NULL );
@@ -101,7 +98,7 @@ static int __init cell_publish_devices(void) }return 0 ; } -device_initcall (cell_publish_devices); +machine_device_initcall (cell, cell_publish_devices);static void cell_mpic_cascade (unsigned int irq,struct irq_desc *desc) {
arch/powerpc/platforms/celleb/iommu.c +1 -5
@@ -91,14 +91,10 @@ static struct notifier_block celleb_of_bus_notifier = {static int __init celleb_init_iommu (void ) { -if (!machine_is (celleb)) -return -ENODEV ; -celleb_init_direct_mapping ();set_pci_dma_ops (&dma_direct_ops);bus_register_notifier (&of_platform_bus_type, &celleb_of_bus_notifier);return 0 ; } - -arch_initcall (celleb_init_iommu); +machine_arch_initcall (celleb, celleb_init_iommu);
arch/powerpc/platforms/celleb/setup.c +1 -4
@@ -127,9 +127,6 @@ static struct of_device_id celleb_bus_ids[] __initdata = {static int __init celleb_publish_devices (void ) { -if (!machine_is (celleb)) -return 0 ; -/* Publish OF platform devices for southbridge IOs */ of_platform_bus_probe (NULL , celleb_bus_ids,NULL );
@@ -137,7 +134,7 @@ static int __init celleb_publish_devices(void)return 0 ; } -device_initcall (celleb_publish_devices); +machine_device_initcall (celleb, celleb_publish_devices);define_machine (celleb) { .name = "Cell Reference Set",
arch/powerpc/platforms/embedded6xx/ls_uart.c +1 -4
@@ -117,9 +117,6 @@ static int __init ls_uarts_init(void)phys_addr_t phys_addr;int len; -if (!machine_is (linkstation)) -return 0 ; - avr =of_find_node_by_path ("/soc10x/serial@80004500" );if (!avr)return -EINVAL ;
@@ -142,4 +139,4 @@ static int __init ls_uarts_init(void)return 0 ; } -late_initcall (ls_uarts_init); +machine_late_initcall (linkstation, ls_uarts_init);
arch/powerpc/platforms/pasemi/idle.c +1 -4
@@ -74,9 +74,6 @@ static int pasemi_system_reset_exception(struct pt_regs *regs)static int __init pasemi_idle_init (void ) { -if (!machine_is (pasemi)) -return -ENODEV ; -#ifndef CONFIG_PPC_PASEMI_CPUFREQ printk (KERN_WARNING "No cpufreq driver, powersavings modes disabled\n" ); current_mode =0 ;
@@ -88,7 +85,7 @@ static int __init pasemi_idle_init(void)return 0 ; } -late_initcall (pasemi_idle_init); +machine_late_initcall (pasemi, pasemi_idle_init);static int __init idle_param (char *p) {
arch/powerpc/platforms/pasemi/setup.c +2 -8
@@ -126,9 +126,6 @@ static int __init pas_setup_mce_regs(void)struct pci_dev *dev;int reg; -if (!machine_is (pasemi)) -return -ENODEV ; -/* Remap various SoC status registers for use by the MCE handler */ reg =0 ;
@@ -172,7 +169,7 @@ static int __init pas_setup_mce_regs(void)return 0 ; } -device_initcall (pas_setup_mce_regs); +machine_device_initcall (pasemi, pas_setup_mce_regs);static __init void pas_init_IRQ (void ) {
@@ -369,9 +366,6 @@ static struct of_device_id pasemi_bus_ids[] = {static int __init pasemi_publish_devices (void ) { -if (!machine_is (pasemi)) -return 0 ; -pasemi_pcmcia_init ();/* Publish OF platform devices for SDC and other non-PCI devices */
@@ -379,7 +373,7 @@ static int __init pasemi_publish_devices(void)return 0 ; } -device_initcall (pasemi_publish_devices); +machine_device_initcall (pasemi, pasemi_publish_devices);/*
arch/powerpc/platforms/powermac/low_i2c.c +2 -5
@@ -1462,9 +1462,6 @@ int __init pmac_i2c_init(void)return 0 ; i2c_inited =1 ; -if (!machine_is (powermac)) -return 0 ; -/* Probe keywest-i2c busses */ kw_i2c_probe ();
@@ -1483,7 +1480,7 @@ int __init pmac_i2c_init(void)return 0 ; } -arch_initcall (pmac_i2c_init); +machine_arch_initcall (powermac, pmac_i2c_init);/* Since pmac_i2c_init can be called too early for the platform device * registration, we need to do it at a later time. In our case, subsys
@@ -1515,4 +1512,4 @@ static int __init pmac_i2c_create_platform_devices(void)return 0 ; } -subsys_initcall (pmac_i2c_create_platform_devices); +machine_subsys_initcall (powermac, pmac_i2c_create_platform_devices);
arch/powerpc/platforms/powermac/pfunc_base.c +1 -2
@@ -363,8 +363,7 @@ int __init pmac_pfunc_base_install(void)return 0 ; } - -arch_initcall (pmac_pfunc_base_install); +machine_arch_initcall (powermac, pmac_pfunc_base_install);#ifdef CONFIG_PM
arch/powerpc/platforms/powermac/pic.c +1 -2
@@ -690,6 +690,5 @@ static int __init init_pmacpic_sysfs(void)sysdev_driver_register (&pmacpic_sysclass, &driver_pmacpic);return 0 ; } - -subsys_initcall (init_pmacpic_sysfs); +machine_subsys_initcall (powermac, init_pmacpic_sysfs);
arch/powerpc/platforms/powermac/setup.c +2 -10
@@ -398,17 +398,13 @@ static int initializing = 1;static int pmac_late_init (void ) { -if (!machine_is (powermac)) -return -ENODEV ; - initializing =0 ;/* this is udbg (which is __init) and we can later use it during * cpu hotplug (in smp_core99_kick_cpu) */ ppc_md.progress =NULL ;return 0 ; } - -late_initcall (pmac_late_init); +machine_late_initcall (powermac, pmac_late_init);/* * This is __init_refok because we check for "initializing" before
@@ -535,9 +531,6 @@ static int __init pmac_declare_of_platform_devices(void)if (machine_is (chrp))return -1 ; -if (!machine_is (powermac)) -return 0 ; - np =of_find_node_by_name (NULL ,"valkyrie" );if (np)of_platform_device_create (np,"valkyrie" ,NULL );
@@ -552,8 +545,7 @@ static int __init pmac_declare_of_platform_devices(void)return 0 ; } - -device_initcall (pmac_declare_of_platform_devices); +machine_device_initcall (powermac, pmac_declare_of_platform_devices);/* * Called very early, MMU is off, device-tree isn't unflattened
Re: [PATCH v2 2/2] [POWERPC] Use new machine_xxx_initcall hooks in platform code
Quoted 5 lines · Grant Likely
From: Grant Likely <[email protected]>
This patch makes the platform code use the new machine-specific initcall hooks. This has the advantage of not needing to explicitly test
machine_is()at the top of every initcall function.
Warning: I have *not* exhaustively tested this; just spot checked in a few places. I'll be more thorough once I know everyone is okay with it in principle.
Cheers,
g.
Quoted 696 lines
Signed-off-by Grant Likely <[email protected]>---
arch/powerpc/platforms/40x/kilauea.c | 5 +---- arch/powerpc/platforms/40x/virtex.c | 5 +---- arch/powerpc/platforms/40x/walnut.c | 5 +---- arch/powerpc/platforms/44x/bamboo.c | 5 +---- arch/powerpc/platforms/44x/ebony.c | 5 +---- arch/powerpc/platforms/44x/sequoia.c | 5 +---- arch/powerpc/platforms/82xx/mpc8272_ads.c | 5 +---- arch/powerpc/platforms/82xx/pq2fads.c | 5 +---- arch/powerpc/platforms/83xx/mpc832x_mds.c | 5 +---- arch/powerpc/platforms/83xx/mpc832x_rdb.c | 11 ++--------- arch/powerpc/platforms/83xx/mpc836x_mds.c | 5 +---- arch/powerpc/platforms/85xx/mpc85xx_ads.c | 5 +---- arch/powerpc/platforms/85xx/mpc85xx_cds.c | 6 +----- arch/powerpc/platforms/85xx/mpc85xx_mds.c | 5 +---- arch/powerpc/platforms/8xx/ep88xc.c | 5 ++--- arch/powerpc/platforms/8xx/mpc885ads_setup.c | 5 ++--- arch/powerpc/platforms/cell/io-workarounds.c | 5 +---- arch/powerpc/platforms/cell/iommu.c | 5 +---- arch/powerpc/platforms/cell/pmu.c | 5 +---- arch/powerpc/platforms/cell/setup.c | 5 +---- arch/powerpc/platforms/celleb/iommu.c | 6 +----- arch/powerpc/platforms/celleb/setup.c | 5 +---- arch/powerpc/platforms/embedded6xx/ls_uart.c | 5 +---- arch/powerpc/platforms/pasemi/idle.c | 5 +---- arch/powerpc/platforms/pasemi/setup.c | 10 ++-------- arch/powerpc/platforms/powermac/low_i2c.c | 7 ++----- arch/powerpc/platforms/powermac/pfunc_base.c | 3 +-- arch/powerpc/platforms/powermac/pic.c | 3 +-- arch/powerpc/platforms/powermac/setup.c | 12 ++---------- 29 files changed, 35 insertions(+), 128 deletions(-)arch/powerpc/platforms/40x/kilauea.c +1
-4@@ -29,14 +29,11 @@ static struct of_device_id kilauea_of_bus[] = {static int __init kilauea_device_probe (void ) { -if (!machine_is (kilauea)) -return 0 ; -of_platform_bus_probe (NULL , kilauea_of_bus,NULL );return 0 ; } -device_initcall (kilauea_device_probe); +machine_device_initcall (kilauea, kilauea_device_probe);static int __init kilauea_probe (void ) {arch/powerpc/platforms/40x/virtex.c +1
-4@@ -17,14 +17,11 @@static int __init virtex_device_probe (void ) { -if (!machine_is (virtex)) -return 0 ; -of_platform_bus_probe (NULL ,NULL ,NULL );return 0 ; } -device_initcall (virtex_device_probe); +machine_device_initcall (virtex, virtex_device_probe);static int __init virtex_probe (void ) {arch/powerpc/platforms/40x/walnut.c +1
-4@@ -34,15 +34,12 @@ static struct of_device_id walnut_of_bus[] = {static int __init walnut_device_probe (void ) { -if (!machine_is (walnut)) -return 0 ; -/* FIXME: do bus probe here */ of_platform_bus_probe (NULL , walnut_of_bus,NULL );return 0 ; } -device_initcall (walnut_device_probe); +machine_device_initcall (walnut, walnut_device_probe);static int __init walnut_probe (void ) {arch/powerpc/platforms/44x/bamboo.c +1
-4@@ -32,14 +32,11 @@ static struct of_device_id bamboo_of_bus[] = {static int __init bamboo_device_probe (void ) { -if (!machine_is (bamboo)) -return 0 ; -of_platform_bus_probe (NULL , bamboo_of_bus,NULL );return 0 ; } -device_initcall (bamboo_device_probe); +machine_device_initcall (bamboo, bamboo_device_probe);static int __init bamboo_probe (void ) {arch/powerpc/platforms/44x/ebony.c +1
-4@@ -36,14 +36,11 @@ static struct of_device_id ebony_of_bus[] = {static int __init ebony_device_probe (void ) { -if (!machine_is (ebony)) -return 0 ; -of_platform_bus_probe (NULL , ebony_of_bus,NULL );return 0 ; } -device_initcall (ebony_device_probe); +machine_device_initcall (ebony, ebony_device_probe);/* * Called very early, MMU is off, device-tree isn't unflattened arch/powerpc/platforms/44x/sequoia.c +1
-4@@ -32,14 +32,11 @@ static struct of_device_id sequoia_of_bus[] = {static int __init sequoia_device_probe (void ) { -if (!machine_is (sequoia)) -return 0 ; -of_platform_bus_probe (NULL , sequoia_of_bus,NULL );return 0 ; } -device_initcall (sequoia_device_probe); +machine_device_initcall (sequoia, sequoia_device_probe);static int __init sequoia_probe (void ) {arch/powerpc/platforms/82xx/mpc8272_ads.c +1
-4@@ -165,14 +165,11 @@ static struct of_device_id __initdata of_bus_ids[] = {static int __init declare_of_platform_devices (void ) { -if (!machine_is (mpc8272_ads)) -return 0 ; -/* Publish the QE devices */ of_platform_bus_probe (NULL , of_bus_ids,NULL );return 0 ; } -device_initcall (declare_of_platform_devices); +machine_device_initcall (mpc8272_ads, declare_of_platform_devices);/* * Called very early, device-tree isn't unflattened arch/powerpc/platforms/82xx/pq2fads.c +1
-4@@ -176,14 +176,11 @@ static struct of_device_id __initdata of_bus_ids[] = {static int __init declare_of_platform_devices (void ) { -if (!machine_is (pq2fads)) -return 0 ; -/* Publish the QE devices */ of_platform_bus_probe (NULL , of_bus_ids,NULL );return 0 ; } -device_initcall (declare_of_platform_devices); +machine_device_initcall (pq2fads, declare_of_platform_devices);define_machine (pq2fads) {arch/powerpc/platforms/83xx/mpc832x_mds.c +1
-4@@ -110,15 +110,12 @@ static struct of_device_id mpc832x_ids[] = {static int __init mpc832x_declare_of_platform_devices (void ) { -if (!machine_is (mpc832x_mds)) -return 0 ; -/* Publish the QE devices */ of_platform_bus_probe (NULL , mpc832x_ids,NULL );return 0 ; } -device_initcall (mpc832x_declare_of_platform_devices); +machine_device_initcall (mpc832x_mds, mpc832x_declare_of_platform_devices);static void __init mpc832x_sys_init_IRQ (void ) {arch/powerpc/platforms/83xx/mpc832x_rdb.c +2
-9@@ -63,9 +63,6 @@ static struct spi_board_info mpc832x_spi_boardinfo = {static int __init mpc832x_spi_init (void ) { -if (!machine_is (mpc832x_rdb)) -return 0 ; -par_io_config_pin (3 ,0 ,3 ,0 ,1 ,0 );/* SPI1 MOSI, I/O */ par_io_config_pin (3 ,1 ,3 ,0 ,1 ,0 );/* SPI1 MISO, I/O */ par_io_config_pin (3 ,2 ,3 ,0 ,1 ,0 );/* SPI1 CLK, I/O */ @@ -79,8 +76,7 @@ static int __init mpc832x_spi_init(void) mpc83xx_spi_activate_cs, mpc83xx_spi_deactivate_cs); } - -device_initcall (mpc832x_spi_init); +machine_device_initcall (mpc832x_rdb, mpc832x_spi_init);/* ************************************************************************ * @@ -123,15 +119,12 @@ static struct of_device_id mpc832x_ids[] = {static int __init mpc832x_declare_of_platform_devices (void ) { -if (!machine_is (mpc832x_rdb)) -return 0 ; -/* Publish the QE devices */ of_platform_bus_probe (NULL , mpc832x_ids,NULL );return 0 ; } -device_initcall (mpc832x_declare_of_platform_devices); +machine_device_initcall (mpc832x_rdb, mpc832x_declare_of_platform_devices);void __init mpc832x_rdb_init_IRQ (void ) {arch/powerpc/platforms/83xx/mpc836x_mds.c +1
-4@@ -141,15 +141,12 @@ static struct of_device_id mpc836x_ids[] = {static int __init mpc836x_declare_of_platform_devices (void ) { -if (!machine_is (mpc836x_mds)) -return 0 ; -/* Publish the QE devices */ of_platform_bus_probe (NULL , mpc836x_ids,NULL );return 0 ; } -device_initcall (mpc836x_declare_of_platform_devices); +machine_device_initcall (mpc836x_mds, mpc836x_declare_of_platform_devices);static void __init mpc836x_mds_init_IRQ (void ) {arch/powerpc/platforms/85xx/mpc85xx_ads.c +1
-4@@ -233,13 +233,10 @@ static struct of_device_id __initdata of_bus_ids[] = {static int __init declare_of_platform_devices (void ) { -if (!machine_is (mpc85xx_ads)) -return 0 ; -of_platform_bus_probe (NULL , of_bus_ids,NULL );return 0 ; } -device_initcall (declare_of_platform_devices); +machine_device_initcall (mpc85xx_ads, declare_of_platform_devices);/* * Called very early, device-tree isn't unflattened arch/powerpc/platforms/85xx/mpc85xx_cds.c +1
-5@@ -222,9 +222,6 @@ static int mpc85xx_cds_8259_attach(void)struct device_node *cascade_node =NULL ;int cascade_irq; -if (!machine_is (mpc85xx_cds)) -return 0 ; -/* Initialize the i8259 controller */ for_each_node_by_type (np,"interrupt-controller" )if (of_device_is_compatible (np,"chrp,iic" )) {@@ -262,8 +259,7 @@ static int mpc85xx_cds_8259_attach(void) return 0; } - -device_initcall (mpc85xx_cds_8259_attach); +machine_device_initcall (mpc85xx_cds, mpc85xx_cds_8259_attach);#endif /* CONFIG_PPC_I8259 */ arch/powerpc/platforms/85xx/mpc85xx_mds.c +1
-4@@ -144,15 +144,12 @@ static struct of_device_id mpc85xx_ids[] = {static int __init mpc85xx_publish_devices (void ) { -if (!machine_is (mpc85xx_mds)) -return 0 ; -/* Publish the QE devices */ of_platform_bus_probe (NULL ,mpc85xx_ids,NULL );return 0 ; } -device_initcall (mpc85xx_publish_devices); +machine_device_initcall (mpc85xx_mds, mpc85xx_publish_devices);static void __init mpc85xx_mds_pic_init (void ) {arch/powerpc/platforms/8xx/ep88xc.c +2
-3@@ -155,12 +155,11 @@ static struct of_device_id __initdata of_bus_ids[] = {static int __init declare_of_platform_devices (void ) {/* Publish the QE devices */ -if (machine_is (ep88xc)) -of_platform_bus_probe (NULL , of_bus_ids,NULL ); +of_platform_bus_probe (NULL , of_bus_ids,NULL );return 0 ; } -device_initcall (declare_of_platform_devices); +machine_device_initcall (ep88xc, declare_of_platform_devices);define_machine (ep88xc) { .name = "Embedded Planet EP88xC",arch/powerpc/platforms/8xx/mpc885ads_setup.c +2
-3@@ -264,12 +264,11 @@ static struct of_device_id __initdata of_bus_ids[] = {static int __init declare_of_platform_devices (void ) {/* Publish the QE devices */ -if (machine_is (mpc885_ads)) -of_platform_bus_probe (NULL , of_bus_ids,NULL ); +of_platform_bus_probe (NULL , of_bus_ids,NULL );return 0 ; } -device_initcall (declare_of_platform_devices); +machine_device_initcall (mpc885_ads, declare_of_platform_devices);define_machine (mpc885_ads) { .name = "Freescale MPC885 ADS",arch/powerpc/platforms/cell/io-workarounds.c +1
-4@@ -309,9 +309,6 @@ static int __init spider_pci_workaround_init(void) {struct pci_controller *phb; -if (!machine_is (cell)) -return 0 ; -/* Find spider bridges. We assume they have been all probed * in setup_arch(). If that was to change, we would need to * update this code to cope with dynamically added busses @@ -343,4 +340,4 @@ static int __init spider_pci_workaround_init(void)return 0 ; } -arch_initcall (spider_pci_workaround_init); +machine_arch_initcall (cell, spider_pci_workaround_init);arch/powerpc/platforms/cell/iommu.c +1
-4@@ -699,9 +699,6 @@ static int __init cell_iommu_init(void) {struct device_node *np; -if (!machine_is (cell)) -return -ENODEV ; -/* If IOMMU is disabled or we have little enough RAM to not need * to enable it, we setup a direct mapping. * @@ -744,5 +741,5 @@ static int __init cell_iommu_init(void)return 0 ; } -arch_initcall (cell_iommu_init); +machine_arch_initcall (cell, cell_iommu_init);arch/powerpc/platforms/cell/pmu.c +1
-4@@ -381,9 +381,6 @@ static int __init cbe_init_pm_irq(void)unsigned int irq;int rc, node; -if (!machine_is (cell)) -return 0 ; -for_each_node (node) { irq =irq_create_mapping (NULL ,IIC_IRQ_IOEX_PMI | (node <<IIC_IRQ_NODE_SHIFT ));@@ -404,7 +401,7 @@ static int __init cbe_init_pm_irq(void)return 0 ; } -arch_initcall (cbe_init_pm_irq); +machine_arch_initcall (cell, cbe_init_pm_irq);void cbe_sync_irq (int node) {arch/powerpc/platforms/cell/setup.c +1
-4@@ -85,9 +85,6 @@ static int __init cell_publish_devices(void) {int node; -if (!machine_is (cell)) -return 0 ; -/* Publish OF platform devices for southbridge IOs */ of_platform_bus_probe (NULL ,NULL ,NULL );@@ -101,7 +98,7 @@ static int __init cell_publish_devices(void) }return 0 ; } -device_initcall (cell_publish_devices); +machine_device_initcall (cell, cell_publish_devices);static void cell_mpic_cascade (unsigned int irq,struct irq_desc *desc) {arch/powerpc/platforms/celleb/iommu.c +1
-5@@ -91,14 +91,10 @@ static struct notifier_block celleb_of_bus_notifier = {static int __init celleb_init_iommu (void ) { -if (!machine_is (celleb)) -return -ENODEV ; -celleb_init_direct_mapping ();set_pci_dma_ops (&dma_direct_ops);bus_register_notifier (&of_platform_bus_type, &celleb_of_bus_notifier);return 0 ; } - -arch_initcall (celleb_init_iommu); +machine_arch_initcall (celleb, celleb_init_iommu);arch/powerpc/platforms/celleb/setup.c +1
-4@@ -127,9 +127,6 @@ static struct of_device_id celleb_bus_ids[] __initdata = {static int __init celleb_publish_devices (void ) { -if (!machine_is (celleb)) -return 0 ; -/* Publish OF platform devices for southbridge IOs */ of_platform_bus_probe (NULL , celleb_bus_ids,NULL );@@ -137,7 +134,7 @@ static int __init celleb_publish_devices(void)return 0 ; } -device_initcall (celleb_publish_devices); +machine_device_initcall (celleb, celleb_publish_devices);define_machine (celleb) { .name = "Cell Reference Set",arch/powerpc/platforms/embedded6xx/ls_uart.c +1
-4@@ -117,9 +117,6 @@ static int __init ls_uarts_init(void)phys_addr_t phys_addr;int len; -if (!machine_is (linkstation)) -return 0 ; - avr =of_find_node_by_path ("/soc10x/serial@80004500" );if (!avr)return -EINVAL ;@@ -142,4 +139,4 @@ static int __init ls_uarts_init(void)return 0 ; } -late_initcall (ls_uarts_init); +machine_late_initcall (linkstation, ls_uarts_init);arch/powerpc/platforms/pasemi/idle.c +1
-4@@ -74,9 +74,6 @@ static int pasemi_system_reset_exception(struct pt_regs *regs)static int __init pasemi_idle_init (void ) { -if (!machine_is (pasemi)) -return -ENODEV ; -#ifndef CONFIG_PPC_PASEMI_CPUFREQ printk (KERN_WARNING "No cpufreq driver, powersavings modes disabled\n" ); current_mode =0 ;@@ -88,7 +85,7 @@ static int __init pasemi_idle_init(void)return 0 ; } -late_initcall (pasemi_idle_init); +machine_late_initcall (pasemi, pasemi_idle_init);static int __init idle_param (char *p) {arch/powerpc/platforms/pasemi/setup.c +2
-8@@ -126,9 +126,6 @@ static int __init pas_setup_mce_regs(void)struct pci_dev *dev;int reg; -if (!machine_is (pasemi)) -return -ENODEV ; -/* Remap various SoC status registers for use by the MCE handler */ reg =0 ;@@ -172,7 +169,7 @@ static int __init pas_setup_mce_regs(void)return 0 ; } -device_initcall (pas_setup_mce_regs); +machine_device_initcall (pasemi, pas_setup_mce_regs);static __init void pas_init_IRQ (void ) {@@ -369,9 +366,6 @@ static struct of_device_id pasemi_bus_ids[] = {static int __init pasemi_publish_devices (void ) { -if (!machine_is (pasemi)) -return 0 ; -pasemi_pcmcia_init ();/* Publish OF platform devices for SDC and other non-PCI devices */ @@ -379,7 +373,7 @@ static int __init pasemi_publish_devices(void)return 0 ; } -device_initcall (pasemi_publish_devices); +machine_device_initcall (pasemi, pasemi_publish_devices);/* arch/powerpc/platforms/powermac/low_i2c.c +2
-5@@ -1462,9 +1462,6 @@ int __init pmac_i2c_init(void)return 0 ; i2c_inited =1 ; -if (!machine_is (powermac)) -return 0 ; -/* Probe keywest-i2c busses */ kw_i2c_probe ();@@ -1483,7 +1480,7 @@ int __init pmac_i2c_init(void)return 0 ; } -arch_initcall (pmac_i2c_init); +machine_arch_initcall (powermac, pmac_i2c_init);/* Since pmac_i2c_init can be called too early for the platform device * registration, we need to do it at a later time. In our case, subsys @@ -1515,4 +1512,4 @@ static int __init pmac_i2c_create_platform_devices(void)return 0 ; } -subsys_initcall (pmac_i2c_create_platform_devices); +machine_subsys_initcall (powermac, pmac_i2c_create_platform_devices);arch/powerpc/platforms/powermac/pfunc_base.c +1
-2@@ -363,8 +363,7 @@ int __init pmac_pfunc_base_install(void)return 0 ; } - -arch_initcall (pmac_pfunc_base_install); +machine_arch_initcall (powermac, pmac_pfunc_base_install);#ifdef CONFIG_PM arch/powerpc/platforms/powermac/pic.c +1
-2@@ -690,6 +690,5 @@ static int __init init_pmacpic_sysfs(void)sysdev_driver_register (&pmacpic_sysclass, &driver_pmacpic);return 0 ; } - -subsys_initcall (init_pmacpic_sysfs); +machine_subsys_initcall (powermac, init_pmacpic_sysfs);arch/powerpc/platforms/powermac/setup.c +2
-10@@ -398,17 +398,13 @@ static int initializing = 1;static int pmac_late_init (void ) { -if (!machine_is (powermac)) -return -ENODEV ; - initializing =0 ;/* this is udbg (which is __init) and we can later use it during * cpu hotplug (in smp_core99_kick_cpu) */ ppc_md.progress =NULL ;return 0 ; } - -late_initcall (pmac_late_init); +machine_late_initcall (powermac, pmac_late_init);/* * This is __init_refok because we check for "initializing" before @@ -535,9 +531,6 @@ static int __init pmac_declare_of_platform_devices(void)if (machine_is (chrp))return -1 ; -if (!machine_is (powermac)) -return 0 ; - np =of_find_node_by_name (NULL ,"valkyrie" );if (np)of_platform_device_create (np,"valkyrie" ,NULL );@@ -552,8 +545,7 @@ static int __init pmac_declare_of_platform_devices(void)return 0 ; } - -device_initcall (pmac_declare_of_platform_devices); +machine_device_initcall (powermac, pmac_declare_of_platform_devices);/* * Called very early, MMU is off, device-tree isn't unflattened
Signature · 4 lines
Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd. [email protected] (403) 399-0195
Re: [PATCH v2 2/2] [POWERPC] Use new machine_xxx_initcall hooks in platform code
In reply to Grant LikelyQuoted 7 lines · Grant Likely
From: Grant Likely <[email protected]>
This patch makes the platform code use the new machine-specific initcall hooks. This has the advantage of not needing to explicitly test
machine_is()at the top of every initcall function.Signed-off-by Grant Likely <[email protected]>
PA Semi parts:
Overall I approve of the approach as well, looks like a good idea. I tried building all defconfigs, they pass.
-Olof
Re: [PATCH v2 2/2] [POWERPC] Use new machine_xxx_initcall hooks in platform code
In reply to Grant LikelyQuoted 5 lines · Grant Likely
From: Grant Likely <[email protected]>
This patch makes the platform code use the new machine-specific initcall hooks. This has the advantage of not needing to explicitly test
machine_is()at the top of every initcall function.
You seem to have missed the PS3 *_initcall()s.
Probably because they test for firmware_has_feature(FW_FEATURE_PS3_LV1) instead of machine_is(ps3).
With kind regards,
Geert Uytterhoeven
Software Architect
Sony Network and Software Technology Center Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium
Phone: +32 (0)2 700 8453 Fax: +32 (0)2 700 8622 E-mail: [email protected] Internet: http://www.sony-europe.com/
Sony Network and Software Technology Center Europe
A division of Sony Service Centre (Europe) N.V. Registered office: Technologielaan 7 · B-1840 Londerzeel · Belgium VAT BE 0413.825.160 · RPR Brussels
Fortis Bank Zaventem · Swift GEBABEBB08A · IBAN BE39001382358619
Re: [PATCH v2 2/2] [POWERPC] Use new machine_xxx_initcall hooks in platform code
Quoted 10 lines · Geert Uytterhoeven
Quoted 5 lines · Grant Likely
From: Grant Likely <[email protected]>
This patch makes the platform code use the new machine-specific initcall hooks. This has the advantage of not needing to explicitly test
machine_is()at the top of every initcall function.You seem to have missed the PS3 *_initcall()s.
Probably because they test forfirmware_has_feature(FW_FEATURE_PS3_LV1)instead ofmachine_is(ps3).
That's exactly why; I didn't know if 'machine_is(ps3)' was a suitable substitute so I left it alone.
Cheers,
g.
Signature · 4 lines
Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd. [email protected] (403) 399-0195
Re: [PATCH v2 2/2] [POWERPC] Use new machine_xxx_initcall hooks in platform code
Quoted 8 lines · Grant Likely
Quoted 7 lines · Geert Uytterhoeven
Quoted 5 lines · Grant Likely
From: Grant Likely <[email protected]>
This patch makes the platform code use the new machine-specific initcall hooks. This has the advantage of not needing to explicitly test
machine_is()at the top of every initcall function.
Quoted 6 lines
Quoted 3 lines
You seem to have missed the PS3 *_initcall()s.
Probably because they test forfirmware_has_feature(FW_FEATURE_PS3_LV1)instead ofmachine_is(ps3).That's exactly why; I didn't know if '
machine_is(ps3)' was a suitable substitute so I left it alone.
I think it's OK. But...
Geoff: is there any specific reason why you usedfirmware_has_feature(FW_FEATURE_PS3_LV1)?
With kind regards,
Geert Uytterhoeven
Software Architect
Sony Network and Software Technology Center Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium
Phone: +32 (0)2 700 8453 Fax: +32 (0)2 700 8622 E-mail: [email protected] Internet: http://www.sony-europe.com/
Sony Network and Software Technology Center Europe
A division of Sony Service Centre (Europe) N.V. Registered office: Technologielaan 7 · B-1840 Londerzeel · Belgium VAT BE 0413.825.160 · RPR Brussels
Fortis Bank Zaventem · Swift GEBABEBB08A · IBAN BE39001382358619
Re: [PATCH v2 2/2] [POWERPC] Use new machine_xxx_initcall hooks in platform code
Quoted 13 lines · Geert Uytterhoeven
Quoted 12 lines · Grant Likely
Quoted 10 lines · Geert Uytterhoeven
Quoted 5 lines · Grant Likely
From: Grant Likely <[email protected]>
This patch makes the platform code use the new machine-specific initcall hooks. This has the advantage of not needing to explicitly test
machine_is()at the top of every initcall function.You seem to have missed the PS3 *_initcall()s.
Probably because they test forfirmware_has_feature(FW_FEATURE_PS3_LV1)instead ofmachine_is(ps3).
Quoted 7 lines
Quoted 2 lines
That's exactly why; I didn't know if '
machine_is(ps3)' was a suitable substitute so I left it alone.I think it's OK. But...
Geoff: is there any specific reason why you used
firmware_has_feature(FW_FEATURE_PS3_LV1)?
As Arnd pointed out, the code in the firmware_has_feature() conditional will be removed by the optimizer when the kernel is built without support for that feature. This then gives a multi-platform binary that has only the code for the sub-set of features the user selected.
-Geoff
Re: [PATCH v2 2/2] [POWERPC] Use new machine_xxx_initcall hooks in platform code
In reply to Grant LikelyQuoted 8 lines · Grant Likely
Quoted 7 lines · Geert Uytterhoeven
Quoted 5 lines · Grant Likely
From: Grant Likely <[email protected]>
This patch makes the platform code use the new machine-specific initcall hooks. This has the advantage of not needing to explicitly test
machine_is()at the top of every initcall function.
Quoted 6 lines
Quoted 3 lines
You seem to have missed the PS3 *_initcall()s.
Probably because they test forfirmware_has_feature(FW_FEATURE_PS3_LV1)instead ofmachine_is(ps3).That's exactly why; I didn't know if '
machine_is(ps3)' was a suitable substitute so I left it alone.
On that topic; I left some pseries and iseries stuff alone also for the same reason.
Cheers,
g.
Signature · 4 lines
Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd. [email protected] (403) 399-0195
Re: [PATCH v2 2/2] [POWERPC] Use new machine_xxx_initcall hooks in platform code
Quoted 11 lines · Grant Likely
Quoted 7 lines · Grant Likely
Quoted 3 lines · Geert Uytterhoeven
You seem to have missed the PS3 *_initcall()s.
Probably because they test forfirmware_has_feature(FW_FEATURE_PS3_LV1)instead ofmachine_is(ps3).That's exactly why; I didn't know if '
machine_is(ps3)' was a suitable substitute so I left it alone.On that topic; I left some pseries and iseries stuff alone also for the same reason.
Yes, and in many cases it's the right answer to base a decision on a specific feature rather than a platform name, for two reasons:
1. If another platform gets added that uses the same firmware feature, it will automatically do the right thing.
2. The call to firmware_has_feature() turns into a compile-time check in many cases, so if the kernel does not contain support for any firmware with the given feature, all the code referenced it can get optimized away by the compiler.
If we have many cases where an initcall is done based on a specific fw-feature or cpu-feature, we might want to add a similar initcall mechanism for those along the lines of machine_xxx_initcall, but of course we should be sure not to overengineer things here.
Arnd <><
Re: [PATCH v2 2/2] [POWERPC] Use new machine_xxx_initcall hooks in platform code
Quoted 4 lines · Arnd Bergmann
1. If another platform gets added that uses the same firmware feature, it
will automatically do the right thing.
Yes but is it something that we want to happen ? That is, do we want code somewhere in a platform/foo dir to run when using platform/bar because they happen to share a feature ?
I don't think so ... such code should be located elsewhere, maybe in sysdev, where it's clear that it's shared.
Thus, thing that is -really- platform specific and wants to stay in the platform code should move to the new mechanism I believe.
As for PS3, will there ever be another platform using LV1 ? If that is the case, we may want to create a shared directory with all the LV1 bits...
Quoted 5 lines
2. The call to
firmware_has_feature()turns into a compile-time check in
many cases, so if the kernel does not contain support for any firmware with the given feature, all the code referenced it can get optimized away by the compiler.
The machine init stuff will soon get rid of whatever test is in it too, as soon as I get to do the ELF magic.
Ben.
Re: [PATCH v2 2/2] [POWERPC] Use new machine_xxx_initcall hooks in platform code
Quoted 9 lines · Benjamin Herrenschmidt
Quoted 4 lines · Arnd Bergmann
1. If another platform gets added that uses the same firmware feature, it
will automatically do the right thing.Yes but is it something that we want to happen ? That is, do we want code somewhere in a platform/foo dir to run when using platform/bar because they happen to share a feature ?
It should be decided case-by-case of course. My assumption was that in those places where we currently check the firmware feature, that is actually the right thing to do.
For the lv1 specific device drivers (vuart, sound, graphics, ...), my feeling is that they should really check for lv1, not for ps3, because the check for lv1 is only needed in order to make sure that you can run the hcall that probes for the actual device.
For some of the iseries checks, it would be more logical to test the platform instead of the firmware feature IMHO, but I don't see a significant reason to change that.
Arnd <><
Re: [PATCH v2 2/2] [POWERPC] Use new machine_xxx_initcall hooks in platform code
In reply to Benjamin HerrenschmidtQuoted 8 lines · Benjamin Herrenschmidt
Quoted 5 lines
2. The call to
firmware_has_feature()turns into a compile-time check in
many cases, so if the kernel does not contain support for any firmware with the given feature, all the code referenced it can get optimized away by the compiler.The machine init stuff will soon get rid of whatever test is in it too, as soon as I get to do the ELF magic.
Section magic is often painful and causes a number of problems. Moreover, it won't do the same thing as what the compiler can do. Consider
static int x __attribute__((section("some_platform.data"))) = 1; static int f(void) __attribute__((section("some_platform.text")));
{
if (firmware_has_feature(FOO))
return x;
return 0;
}When firmware_has_feature(FOO) statically evaluates to false, f becomes an empty function and x is left out from the object file.
If you turn it into a platform_is() check and discard all "some_platform" sections, you need to have both in the vmlinux file and can discard them at run time, which is something completely different. You can also discard them in the linker script, but that's a lot more work than having the compiler do the right thing.
Arnd <><