All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] [POWERPC] Add machine initcall macros
@ 2007-12-02  6:10 Grant Likely
  2007-12-02  6:10 ` [PATCH v2 2/2] [POWERPC] Use new machine_xxx_initcall hooks in platform code Grant Likely
  0 siblings, 1 reply; 13+ messages in thread
From: Grant Likely @ 2007-12-02  6:10 UTC (permalink / raw)
  To: linuxppc-dev, benh, vitb, galak, olof, jwboyer

From: Grant Likely <grant.likely@secretlab.ca>

The machine initcall macros allow initcalls to be registered which
test machine_is() before executing the initcall.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---

 include/asm-powerpc/machdep.h |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/include/asm-powerpc/machdep.h b/include/asm-powerpc/machdep.h
index 6968f43..d5cd982 100644
--- a/include/asm-powerpc/machdep.h
+++ b/include/asm-powerpc/machdep.h
@@ -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 */

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 2/2] [POWERPC] Use new machine_xxx_initcall hooks in platform code
  2007-12-02  6:10 [PATCH v2 1/2] [POWERPC] Add machine initcall macros Grant Likely
@ 2007-12-02  6:10 ` Grant Likely
  2007-12-02  6:17   ` Grant Likely
                     ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Grant Likely @ 2007-12-02  6:10 UTC (permalink / raw)
  To: linuxppc-dev, benh, vitb, galak, olof, jwboyer

From: Grant Likely <grant.likely@secretlab.ca>

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 <grant.likely@secretlab.ca>
---

 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(-)

diff --git a/arch/powerpc/platforms/40x/kilauea.c b/arch/powerpc/platforms/40x/kilauea.c
index 1bffdbd..0853db7 100644
--- a/arch/powerpc/platforms/40x/kilauea.c
+++ b/arch/powerpc/platforms/40x/kilauea.c
@@ -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)
 {
diff --git a/arch/powerpc/platforms/40x/virtex.c b/arch/powerpc/platforms/40x/virtex.c
index 14bbc32..43fcc8e 100644
--- a/arch/powerpc/platforms/40x/virtex.c
+++ b/arch/powerpc/platforms/40x/virtex.c
@@ -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)
 {
diff --git a/arch/powerpc/platforms/40x/walnut.c b/arch/powerpc/platforms/40x/walnut.c
index ff6db24..91a5247 100644
--- a/arch/powerpc/platforms/40x/walnut.c
+++ b/arch/powerpc/platforms/40x/walnut.c
@@ -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)
 {
diff --git a/arch/powerpc/platforms/44x/bamboo.c b/arch/powerpc/platforms/44x/bamboo.c
index be23f11..5253996 100644
--- a/arch/powerpc/platforms/44x/bamboo.c
+++ b/arch/powerpc/platforms/44x/bamboo.c
@@ -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)
 {
diff --git a/arch/powerpc/platforms/44x/ebony.c b/arch/powerpc/platforms/44x/ebony.c
index 6cd3476..b783c6e 100644
--- a/arch/powerpc/platforms/44x/ebony.c
+++ b/arch/powerpc/platforms/44x/ebony.c
@@ -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
diff --git a/arch/powerpc/platforms/44x/sequoia.c b/arch/powerpc/platforms/44x/sequoia.c
index 21a9dd1..e5be0c7 100644
--- a/arch/powerpc/platforms/44x/sequoia.c
+++ b/arch/powerpc/platforms/44x/sequoia.c
@@ -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)
 {
diff --git a/arch/powerpc/platforms/82xx/mpc8272_ads.c b/arch/powerpc/platforms/82xx/mpc8272_ads.c
index fd83440..3fce6b3 100644
--- a/arch/powerpc/platforms/82xx/mpc8272_ads.c
+++ b/arch/powerpc/platforms/82xx/mpc8272_ads.c
@@ -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
diff --git a/arch/powerpc/platforms/82xx/pq2fads.c b/arch/powerpc/platforms/82xx/pq2fads.c
index 4f457a9..c5430b3 100644
--- a/arch/powerpc/platforms/82xx/pq2fads.c
+++ b/arch/powerpc/platforms/82xx/pq2fads.c
@@ -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)
 {
diff --git a/arch/powerpc/platforms/83xx/mpc832x_mds.c b/arch/powerpc/platforms/83xx/mpc832x_mds.c
index 39ee7a1..6b9d72a 100644
--- a/arch/powerpc/platforms/83xx/mpc832x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc832x_mds.c
@@ -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)
 {
diff --git a/arch/powerpc/platforms/83xx/mpc832x_rdb.c b/arch/powerpc/platforms/83xx/mpc832x_rdb.c
index d4bd040..67a282f 100644
--- a/arch/powerpc/platforms/83xx/mpc832x_rdb.c
+++ b/arch/powerpc/platforms/83xx/mpc832x_rdb.c
@@ -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)
 {
diff --git a/arch/powerpc/platforms/83xx/mpc836x_mds.c b/arch/powerpc/platforms/83xx/mpc836x_mds.c
index e40012f..9f37718 100644
--- a/arch/powerpc/platforms/83xx/mpc836x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc836x_mds.c
@@ -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)
 {
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ads.c b/arch/powerpc/platforms/85xx/mpc85xx_ads.c
index bccdc25..a3fa1b0 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ads.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ads.c
@@ -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
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_cds.c b/arch/powerpc/platforms/85xx/mpc85xx_cds.c
index 4d063ee..8b1de78 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_cds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_cds.c
@@ -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 */
 
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
index 61b3eed..5f68c99 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
@@ -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)
 {
diff --git a/arch/powerpc/platforms/8xx/ep88xc.c b/arch/powerpc/platforms/8xx/ep88xc.c
index c518b6c..88afa35 100644
--- a/arch/powerpc/platforms/8xx/ep88xc.c
+++ b/arch/powerpc/platforms/8xx/ep88xc.c
@@ -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",
diff --git a/arch/powerpc/platforms/8xx/mpc885ads_setup.c b/arch/powerpc/platforms/8xx/mpc885ads_setup.c
index 2cf1b6a..6ef8e9e 100644
--- a/arch/powerpc/platforms/8xx/mpc885ads_setup.c
+++ b/arch/powerpc/platforms/8xx/mpc885ads_setup.c
@@ -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",
diff --git a/arch/powerpc/platforms/cell/io-workarounds.c b/arch/powerpc/platforms/cell/io-workarounds.c
index 9d7c2ef..e3ae39c 100644
--- a/arch/powerpc/platforms/cell/io-workarounds.c
+++ b/arch/powerpc/platforms/cell/io-workarounds.c
@@ -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);
diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c
index faabc3f..648077f 100644
--- a/arch/powerpc/platforms/cell/iommu.c
+++ b/arch/powerpc/platforms/cell/iommu.c
@@ -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);
 
diff --git a/arch/powerpc/platforms/cell/pmu.c b/arch/powerpc/platforms/cell/pmu.c
index 1ed3036..cb0cdab 100644
--- a/arch/powerpc/platforms/cell/pmu.c
+++ b/arch/powerpc/platforms/cell/pmu.c
@@ -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)
 {
diff --git a/arch/powerpc/platforms/cell/setup.c b/arch/powerpc/platforms/cell/setup.c
index 98e7ef8..8390d2d 100644
--- a/arch/powerpc/platforms/cell/setup.c
+++ b/arch/powerpc/platforms/cell/setup.c
@@ -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)
 {
diff --git a/arch/powerpc/platforms/celleb/iommu.c b/arch/powerpc/platforms/celleb/iommu.c
index 755d869..c9884f4 100644
--- a/arch/powerpc/platforms/celleb/iommu.c
+++ b/arch/powerpc/platforms/celleb/iommu.c
@@ -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);
diff --git a/arch/powerpc/platforms/celleb/setup.c b/arch/powerpc/platforms/celleb/setup.c
index ddfb35a..aa18f95 100644
--- a/arch/powerpc/platforms/celleb/setup.c
+++ b/arch/powerpc/platforms/celleb/setup.c
@@ -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",
diff --git a/arch/powerpc/platforms/embedded6xx/ls_uart.c b/arch/powerpc/platforms/embedded6xx/ls_uart.c
index c99264c..9d891bd 100644
--- a/arch/powerpc/platforms/embedded6xx/ls_uart.c
+++ b/arch/powerpc/platforms/embedded6xx/ls_uart.c
@@ -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);
diff --git a/arch/powerpc/platforms/pasemi/idle.c b/arch/powerpc/platforms/pasemi/idle.c
index d8e1fcc..43911d8 100644
--- a/arch/powerpc/platforms/pasemi/idle.c
+++ b/arch/powerpc/platforms/pasemi/idle.c
@@ -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)
 {
diff --git a/arch/powerpc/platforms/pasemi/setup.c b/arch/powerpc/platforms/pasemi/setup.c
index 3d62060..59c8371 100644
--- a/arch/powerpc/platforms/pasemi/setup.c
+++ b/arch/powerpc/platforms/pasemi/setup.c
@@ -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);
 
 
 /*
diff --git a/arch/powerpc/platforms/powermac/low_i2c.c b/arch/powerpc/platforms/powermac/low_i2c.c
index da2007e..9c9299c 100644
--- a/arch/powerpc/platforms/powermac/low_i2c.c
+++ b/arch/powerpc/platforms/powermac/low_i2c.c
@@ -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);
diff --git a/arch/powerpc/platforms/powermac/pfunc_base.c b/arch/powerpc/platforms/powermac/pfunc_base.c
index 45d54b9..db20de5 100644
--- a/arch/powerpc/platforms/powermac/pfunc_base.c
+++ b/arch/powerpc/platforms/powermac/pfunc_base.c
@@ -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
 
diff --git a/arch/powerpc/platforms/powermac/pic.c b/arch/powerpc/platforms/powermac/pic.c
index 999f5e1..cd72164 100644
--- a/arch/powerpc/platforms/powermac/pic.c
+++ b/arch/powerpc/platforms/powermac/pic.c
@@ -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);
 
diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c
index 02c5330..0421189 100644
--- a/arch/powerpc/platforms/powermac/setup.c
+++ b/arch/powerpc/platforms/powermac/setup.c
@@ -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

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 2/2] [POWERPC] Use new machine_xxx_initcall hooks in platform code
  2007-12-02  6:10 ` [PATCH v2 2/2] [POWERPC] Use new machine_xxx_initcall hooks in platform code Grant Likely
@ 2007-12-02  6:17   ` Grant Likely
  2007-12-02 19:15   ` Olof Johansson
  2007-12-04 12:23   ` Geert Uytterhoeven
  2 siblings, 0 replies; 13+ messages in thread
From: Grant Likely @ 2007-12-02  6:17 UTC (permalink / raw)
  To: linuxppc-dev, benh, vitb, galak, olof, jwboyer

On 12/1/07, Grant Likely <grant.likely@secretlab.ca> wrote:
> From: Grant Likely <grant.likely@secretlab.ca>
>
> 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.

>
> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
> ---
>
>  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(-)
>
> diff --git a/arch/powerpc/platforms/40x/kilauea.c b/arch/powerpc/platforms/40x/kilauea.c
> index 1bffdbd..0853db7 100644
> --- a/arch/powerpc/platforms/40x/kilauea.c
> +++ b/arch/powerpc/platforms/40x/kilauea.c
> @@ -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)
>  {
> diff --git a/arch/powerpc/platforms/40x/virtex.c b/arch/powerpc/platforms/40x/virtex.c
> index 14bbc32..43fcc8e 100644
> --- a/arch/powerpc/platforms/40x/virtex.c
> +++ b/arch/powerpc/platforms/40x/virtex.c
> @@ -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)
>  {
> diff --git a/arch/powerpc/platforms/40x/walnut.c b/arch/powerpc/platforms/40x/walnut.c
> index ff6db24..91a5247 100644
> --- a/arch/powerpc/platforms/40x/walnut.c
> +++ b/arch/powerpc/platforms/40x/walnut.c
> @@ -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)
>  {
> diff --git a/arch/powerpc/platforms/44x/bamboo.c b/arch/powerpc/platforms/44x/bamboo.c
> index be23f11..5253996 100644
> --- a/arch/powerpc/platforms/44x/bamboo.c
> +++ b/arch/powerpc/platforms/44x/bamboo.c
> @@ -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)
>  {
> diff --git a/arch/powerpc/platforms/44x/ebony.c b/arch/powerpc/platforms/44x/ebony.c
> index 6cd3476..b783c6e 100644
> --- a/arch/powerpc/platforms/44x/ebony.c
> +++ b/arch/powerpc/platforms/44x/ebony.c
> @@ -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
> diff --git a/arch/powerpc/platforms/44x/sequoia.c b/arch/powerpc/platforms/44x/sequoia.c
> index 21a9dd1..e5be0c7 100644
> --- a/arch/powerpc/platforms/44x/sequoia.c
> +++ b/arch/powerpc/platforms/44x/sequoia.c
> @@ -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)
>  {
> diff --git a/arch/powerpc/platforms/82xx/mpc8272_ads.c b/arch/powerpc/platforms/82xx/mpc8272_ads.c
> index fd83440..3fce6b3 100644
> --- a/arch/powerpc/platforms/82xx/mpc8272_ads.c
> +++ b/arch/powerpc/platforms/82xx/mpc8272_ads.c
> @@ -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
> diff --git a/arch/powerpc/platforms/82xx/pq2fads.c b/arch/powerpc/platforms/82xx/pq2fads.c
> index 4f457a9..c5430b3 100644
> --- a/arch/powerpc/platforms/82xx/pq2fads.c
> +++ b/arch/powerpc/platforms/82xx/pq2fads.c
> @@ -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)
>  {
> diff --git a/arch/powerpc/platforms/83xx/mpc832x_mds.c b/arch/powerpc/platforms/83xx/mpc832x_mds.c
> index 39ee7a1..6b9d72a 100644
> --- a/arch/powerpc/platforms/83xx/mpc832x_mds.c
> +++ b/arch/powerpc/platforms/83xx/mpc832x_mds.c
> @@ -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)
>  {
> diff --git a/arch/powerpc/platforms/83xx/mpc832x_rdb.c b/arch/powerpc/platforms/83xx/mpc832x_rdb.c
> index d4bd040..67a282f 100644
> --- a/arch/powerpc/platforms/83xx/mpc832x_rdb.c
> +++ b/arch/powerpc/platforms/83xx/mpc832x_rdb.c
> @@ -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)
>  {
> diff --git a/arch/powerpc/platforms/83xx/mpc836x_mds.c b/arch/powerpc/platforms/83xx/mpc836x_mds.c
> index e40012f..9f37718 100644
> --- a/arch/powerpc/platforms/83xx/mpc836x_mds.c
> +++ b/arch/powerpc/platforms/83xx/mpc836x_mds.c
> @@ -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)
>  {
> diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ads.c b/arch/powerpc/platforms/85xx/mpc85xx_ads.c
> index bccdc25..a3fa1b0 100644
> --- a/arch/powerpc/platforms/85xx/mpc85xx_ads.c
> +++ b/arch/powerpc/platforms/85xx/mpc85xx_ads.c
> @@ -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
> diff --git a/arch/powerpc/platforms/85xx/mpc85xx_cds.c b/arch/powerpc/platforms/85xx/mpc85xx_cds.c
> index 4d063ee..8b1de78 100644
> --- a/arch/powerpc/platforms/85xx/mpc85xx_cds.c
> +++ b/arch/powerpc/platforms/85xx/mpc85xx_cds.c
> @@ -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 */
>
> diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
> index 61b3eed..5f68c99 100644
> --- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c
> +++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
> @@ -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)
>  {
> diff --git a/arch/powerpc/platforms/8xx/ep88xc.c b/arch/powerpc/platforms/8xx/ep88xc.c
> index c518b6c..88afa35 100644
> --- a/arch/powerpc/platforms/8xx/ep88xc.c
> +++ b/arch/powerpc/platforms/8xx/ep88xc.c
> @@ -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",
> diff --git a/arch/powerpc/platforms/8xx/mpc885ads_setup.c b/arch/powerpc/platforms/8xx/mpc885ads_setup.c
> index 2cf1b6a..6ef8e9e 100644
> --- a/arch/powerpc/platforms/8xx/mpc885ads_setup.c
> +++ b/arch/powerpc/platforms/8xx/mpc885ads_setup.c
> @@ -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",
> diff --git a/arch/powerpc/platforms/cell/io-workarounds.c b/arch/powerpc/platforms/cell/io-workarounds.c
> index 9d7c2ef..e3ae39c 100644
> --- a/arch/powerpc/platforms/cell/io-workarounds.c
> +++ b/arch/powerpc/platforms/cell/io-workarounds.c
> @@ -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);
> diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c
> index faabc3f..648077f 100644
> --- a/arch/powerpc/platforms/cell/iommu.c
> +++ b/arch/powerpc/platforms/cell/iommu.c
> @@ -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);
>
> diff --git a/arch/powerpc/platforms/cell/pmu.c b/arch/powerpc/platforms/cell/pmu.c
> index 1ed3036..cb0cdab 100644
> --- a/arch/powerpc/platforms/cell/pmu.c
> +++ b/arch/powerpc/platforms/cell/pmu.c
> @@ -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)
>  {
> diff --git a/arch/powerpc/platforms/cell/setup.c b/arch/powerpc/platforms/cell/setup.c
> index 98e7ef8..8390d2d 100644
> --- a/arch/powerpc/platforms/cell/setup.c
> +++ b/arch/powerpc/platforms/cell/setup.c
> @@ -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)
>  {
> diff --git a/arch/powerpc/platforms/celleb/iommu.c b/arch/powerpc/platforms/celleb/iommu.c
> index 755d869..c9884f4 100644
> --- a/arch/powerpc/platforms/celleb/iommu.c
> +++ b/arch/powerpc/platforms/celleb/iommu.c
> @@ -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);
> diff --git a/arch/powerpc/platforms/celleb/setup.c b/arch/powerpc/platforms/celleb/setup.c
> index ddfb35a..aa18f95 100644
> --- a/arch/powerpc/platforms/celleb/setup.c
> +++ b/arch/powerpc/platforms/celleb/setup.c
> @@ -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",
> diff --git a/arch/powerpc/platforms/embedded6xx/ls_uart.c b/arch/powerpc/platforms/embedded6xx/ls_uart.c
> index c99264c..9d891bd 100644
> --- a/arch/powerpc/platforms/embedded6xx/ls_uart.c
> +++ b/arch/powerpc/platforms/embedded6xx/ls_uart.c
> @@ -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);
> diff --git a/arch/powerpc/platforms/pasemi/idle.c b/arch/powerpc/platforms/pasemi/idle.c
> index d8e1fcc..43911d8 100644
> --- a/arch/powerpc/platforms/pasemi/idle.c
> +++ b/arch/powerpc/platforms/pasemi/idle.c
> @@ -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)
>  {
> diff --git a/arch/powerpc/platforms/pasemi/setup.c b/arch/powerpc/platforms/pasemi/setup.c
> index 3d62060..59c8371 100644
> --- a/arch/powerpc/platforms/pasemi/setup.c
> +++ b/arch/powerpc/platforms/pasemi/setup.c
> @@ -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);
>
>
>  /*
> diff --git a/arch/powerpc/platforms/powermac/low_i2c.c b/arch/powerpc/platforms/powermac/low_i2c.c
> index da2007e..9c9299c 100644
> --- a/arch/powerpc/platforms/powermac/low_i2c.c
> +++ b/arch/powerpc/platforms/powermac/low_i2c.c
> @@ -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);
> diff --git a/arch/powerpc/platforms/powermac/pfunc_base.c b/arch/powerpc/platforms/powermac/pfunc_base.c
> index 45d54b9..db20de5 100644
> --- a/arch/powerpc/platforms/powermac/pfunc_base.c
> +++ b/arch/powerpc/platforms/powermac/pfunc_base.c
> @@ -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
>
> diff --git a/arch/powerpc/platforms/powermac/pic.c b/arch/powerpc/platforms/powermac/pic.c
> index 999f5e1..cd72164 100644
> --- a/arch/powerpc/platforms/powermac/pic.c
> +++ b/arch/powerpc/platforms/powermac/pic.c
> @@ -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);
>
> diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c
> index 02c5330..0421189 100644
> --- a/arch/powerpc/platforms/powermac/setup.c
> +++ b/arch/powerpc/platforms/powermac/setup.c
> @@ -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
>
>


-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 2/2] [POWERPC] Use new machine_xxx_initcall hooks in platform code
  2007-12-02  6:10 ` [PATCH v2 2/2] [POWERPC] Use new machine_xxx_initcall hooks in platform code Grant Likely
  2007-12-02  6:17   ` Grant Likely
@ 2007-12-02 19:15   ` Olof Johansson
  2007-12-04 12:23   ` Geert Uytterhoeven
  2 siblings, 0 replies; 13+ messages in thread
From: Olof Johansson @ 2007-12-02 19:15 UTC (permalink / raw)
  To: Grant Likely; +Cc: linuxppc-dev

On Sat, Dec 01, 2007 at 11:10:33PM -0700, Grant Likely wrote:
> From: Grant Likely <grant.likely@secretlab.ca>
> 
> 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 <grant.likely@secretlab.ca>

PA Semi parts:

Acked-by: Olof Johansson <olof@lixom.net>

Overall I approve of the approach as well, looks like a good idea.
I tried building all defconfigs, they pass.


-Olof

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 2/2] [POWERPC] Use new machine_xxx_initcall hooks in platform code
  2007-12-02  6:10 ` [PATCH v2 2/2] [POWERPC] Use new machine_xxx_initcall hooks in platform code Grant Likely
  2007-12-02  6:17   ` Grant Likely
  2007-12-02 19:15   ` Olof Johansson
@ 2007-12-04 12:23   ` Geert Uytterhoeven
  2007-12-04 13:36     ` Grant Likely
  2 siblings, 1 reply; 13+ messages in thread
From: Geert Uytterhoeven @ 2007-12-04 12:23 UTC (permalink / raw)
  To: Grant Likely; +Cc: linuxppc-dev, olof

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1038 bytes --]

On Sat, 1 Dec 2007, Grant Likely wrote:
> From: Grant Likely <grant.likely@secretlab.ca>
> 
> 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:   Geert.Uytterhoeven@sonycom.com	
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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 2/2] [POWERPC] Use new machine_xxx_initcall hooks in platform code
  2007-12-04 12:23   ` Geert Uytterhoeven
@ 2007-12-04 13:36     ` Grant Likely
  2007-12-04 13:43       ` Geert Uytterhoeven
  2007-12-04 14:21       ` Grant Likely
  0 siblings, 2 replies; 13+ messages in thread
From: Grant Likely @ 2007-12-04 13:36 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: linuxppc-dev, olof

On 12/4/07, Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com> wrote:
> On Sat, 1 Dec 2007, Grant Likely wrote:
> > From: Grant Likely <grant.likely@secretlab.ca>
> >
> > 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).

That's exactly why; I didn't know if 'machine_is(ps3)' was a suitable
substitute so I left it alone.

Cheers,
g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 2/2] [POWERPC] Use new machine_xxx_initcall hooks in platform code
  2007-12-04 13:36     ` Grant Likely
@ 2007-12-04 13:43       ` Geert Uytterhoeven
  2007-12-04 20:59         ` Geoff Levand
  2007-12-04 14:21       ` Grant Likely
  1 sibling, 1 reply; 13+ messages in thread
From: Geert Uytterhoeven @ 2007-12-04 13:43 UTC (permalink / raw)
  To: Grant Likely, Geoff Levand; +Cc: olof, Linux/PPC Development

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1414 bytes --]

On Tue, 4 Dec 2007, Grant Likely wrote:
> On 12/4/07, Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com> wrote:
> > On Sat, 1 Dec 2007, Grant Likely wrote:
> > > From: Grant Likely <grant.likely@secretlab.ca>
> > >
> > > 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).
> 
> 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)?

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:   Geert.Uytterhoeven@sonycom.com	
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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 2/2] [POWERPC] Use new machine_xxx_initcall hooks in platform code
  2007-12-04 13:36     ` Grant Likely
  2007-12-04 13:43       ` Geert Uytterhoeven
@ 2007-12-04 14:21       ` Grant Likely
  2007-12-04 19:35         ` Arnd Bergmann
  1 sibling, 1 reply; 13+ messages in thread
From: Grant Likely @ 2007-12-04 14:21 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: linuxppc-dev, olof

On 12/4/07, Grant Likely <grant.likely@secretlab.ca> wrote:
> On 12/4/07, Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com> wrote:
> > On Sat, 1 Dec 2007, Grant Likely wrote:
> > > From: Grant Likely <grant.likely@secretlab.ca>
> > >
> > > 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).
>
> 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.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 2/2] [POWERPC] Use new machine_xxx_initcall hooks in platform code
  2007-12-04 14:21       ` Grant Likely
@ 2007-12-04 19:35         ` Arnd Bergmann
  2007-12-04 20:31           ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 13+ messages in thread
From: Arnd Bergmann @ 2007-12-04 19:35 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Geert Uytterhoeven, olof

On Tuesday 04 December 2007, Grant Likely wrote:
> On 12/4/07, Grant Likely <grant.likely@secretlab.ca> wrote:
> > On 12/4/07, Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com> wrote:
> > > 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).
> >
> > 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 <><

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 2/2] [POWERPC] Use new machine_xxx_initcall hooks in platform code
  2007-12-04 19:35         ` Arnd Bergmann
@ 2007-12-04 20:31           ` Benjamin Herrenschmidt
  2007-12-04 21:52             ` Arnd Bergmann
  2007-12-04 22:05             ` Arnd Bergmann
  0 siblings, 2 replies; 13+ messages in thread
From: Benjamin Herrenschmidt @ 2007-12-04 20:31 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: Geert Uytterhoeven, linuxppc-dev, olof


On Tue, 2007-12-04 at 20:35 +0100, Arnd Bergmann wrote:
> 
> 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...

> 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.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 2/2] [POWERPC] Use new machine_xxx_initcall hooks in platform code
  2007-12-04 13:43       ` Geert Uytterhoeven
@ 2007-12-04 20:59         ` Geoff Levand
  0 siblings, 0 replies; 13+ messages in thread
From: Geoff Levand @ 2007-12-04 20:59 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: Linux/PPC Development, olof

Geert Uytterhoeven wrote:
> On Tue, 4 Dec 2007, Grant Likely wrote:
>> On 12/4/07, Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com> wrote:
>> > On Sat, 1 Dec 2007, Grant Likely wrote:
>> > > From: Grant Likely <grant.likely@secretlab.ca>
>> > >
>> > > 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).
>> 
>> 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 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 2/2] [POWERPC] Use new machine_xxx_initcall hooks in platform code
  2007-12-04 20:31           ` Benjamin Herrenschmidt
@ 2007-12-04 21:52             ` Arnd Bergmann
  2007-12-04 22:05             ` Arnd Bergmann
  1 sibling, 0 replies; 13+ messages in thread
From: Arnd Bergmann @ 2007-12-04 21:52 UTC (permalink / raw)
  To: benh; +Cc: Geert Uytterhoeven, linuxppc-dev, olof

On Tuesday 04 December 2007, Benjamin Herrenschmidt wrote:
> On Tue, 2007-12-04 at 20:35 +0100, Arnd Bergmann wrote:
> > 
> > 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 <><

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 2/2] [POWERPC] Use new machine_xxx_initcall hooks in platform code
  2007-12-04 20:31           ` Benjamin Herrenschmidt
  2007-12-04 21:52             ` Arnd Bergmann
@ 2007-12-04 22:05             ` Arnd Bergmann
  1 sibling, 0 replies; 13+ messages in thread
From: Arnd Bergmann @ 2007-12-04 22:05 UTC (permalink / raw)
  To: benh; +Cc: Geert Uytterhoeven, linuxppc-dev, olof

On Tuesday 04 December 2007, Benjamin Herrenschmidt wrote:
> > 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 <><

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2007-12-04 22:06 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-02  6:10 [PATCH v2 1/2] [POWERPC] Add machine initcall macros Grant Likely
2007-12-02  6:10 ` [PATCH v2 2/2] [POWERPC] Use new machine_xxx_initcall hooks in platform code Grant Likely
2007-12-02  6:17   ` Grant Likely
2007-12-02 19:15   ` Olof Johansson
2007-12-04 12:23   ` Geert Uytterhoeven
2007-12-04 13:36     ` Grant Likely
2007-12-04 13:43       ` Geert Uytterhoeven
2007-12-04 20:59         ` Geoff Levand
2007-12-04 14:21       ` Grant Likely
2007-12-04 19:35         ` Arnd Bergmann
2007-12-04 20:31           ` Benjamin Herrenschmidt
2007-12-04 21:52             ` Arnd Bergmann
2007-12-04 22:05             ` Arnd Bergmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.