Skip to contentSkip to conversation

Only call ppc_md.setup_arch() if it is provided.

PATCH Superseded Grant Likely 2 participants 3 messages Oct 8, 2007

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Only call ppc_md.setup_arch() if it is provided.

From: Grant Likely <[email protected]>

This allows platforms which don't have anything to do at setup_arch time (like a bunch of the 4xx platforms) to eliminate an empty setup_arch hook.

---

 arch/powerpc/kernel/setup_32.c |    3 ++-
 arch/powerpc/kernel/setup_64.c |    3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
arch/powerpc/kernel/setup_32.c +2 -1
index 7474502..cd870a8 100644
@@ -290,7 +290,8 @@ void __init setup_arch(char **cmdline_p)
 	conswitchp = &dummy_con;
 #endif
 
-	ppc_md.setup_arch();
+	if (ppc_md.setup_arch)
+		ppc_md.setup_arch();
 	if ( ppc_md.progress ) ppc_md.progress("arch: exit", 0x3eab);
 
 	paging_init();
arch/powerpc/kernel/setup_64.c +2 -1
index 3089eae..008ab68 100644
@@ -530,7 +530,8 @@ void __init setup_arch(char **cmdline_p)
 	conswitchp = &dummy_con;
 #endif
 
-	ppc_md.setup_arch();
+	if (ppc_md.setup_arch)
+		ppc_md.setup_arch();
 
 	paging_init();
 	ppc64_boot_msg(0x15, "Setup Done");
#1 lore raw

PATCH 2/2 Remove empty ppc_md.setup_arch hooks.

From: Grant Likely <[email protected]>

---

 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 -----
 5 files changed, 0 insertions(+), 25 deletions(-)
arch/powerpc/platforms/40x/virtex.c +0 -5
index b52aa94..14bbc32 100644
@@ -36,14 +36,9 @@ static int __init virtex_probe(void)
 	return 1;
 }
 
-static void __init virtex_setup_arch(void)
-{
-}
-
 define_machine(virtex) {
 	.name			= "Xilinx Virtex",
 	.probe			= virtex_probe,
-	.setup_arch		= virtex_setup_arch,
 	.init_IRQ		= xilinx_intc_init_tree,
 	.get_irq		= xilinx_intc_get_irq,
 	.calibrate_decr		= generic_calibrate_decr,
arch/powerpc/platforms/40x/walnut.c +0 -5
index c17fdf2..eb0c136 100644
@@ -53,14 +53,9 @@ static int __init walnut_probe(void)
 	return 1;
 }
 
-static void __init walnut_setup_arch(void)
-{
-}
-
 define_machine(walnut) {
 	.name			= "Walnut",
 	.probe			= walnut_probe,
-	.setup_arch		= walnut_setup_arch,
 	.progress		= udbg_progress,
 	.init_IRQ		= uic_init_tree,
 	.get_irq		= uic_get_irq,
arch/powerpc/platforms/44x/bamboo.c +0 -5
index 9bc45de..470e1a3 100644
@@ -50,14 +50,9 @@ static int __init bamboo_probe(void)
 	return 1;
 }
 
-static void __init bamboo_setup_arch(void)
-{
-}
-
 define_machine(bamboo) {
 	.name 				= "Bamboo",
 	.probe 				= bamboo_probe,
-	.setup_arch 		= bamboo_setup_arch,
 	.progress 			= udbg_progress,
 	.init_IRQ 			= uic_init_tree,
 	.get_irq 			= uic_get_irq,
arch/powerpc/platforms/44x/ebony.c +0 -5
index 5a7fec8..40e18fc 100644
@@ -57,14 +57,9 @@ static int __init ebony_probe(void)
 	return 1;
 }
 
-static void __init ebony_setup_arch(void)
-{
-}
-
 define_machine(ebony) {
 	.name			= "Ebony",
 	.probe			= ebony_probe,
-	.setup_arch		= ebony_setup_arch,
 	.progress		= udbg_progress,
 	.init_IRQ		= uic_init_tree,
 	.get_irq		= uic_get_irq,
arch/powerpc/platforms/44x/sequoia.c +0 -5
index 7d0d9d5..30700b3 100644
@@ -50,14 +50,9 @@ static int __init sequoia_probe(void)
 	return 1;
 }
 
-static void __init sequoia_setup_arch(void)
-{
-}
-
 define_machine(sequoia) {
 	.name 				= "Sequoia",
 	.probe 				= sequoia_probe,
-	.setup_arch			= sequoia_setup_arch,
 	.progress 			= udbg_progress,
 	.init_IRQ 			= uic_init_tree,
 	.get_irq 			= uic_get_irq,
#2 lore raw
In reply to Grant Likely
Quoted 7 lines · Grant Likely

From: Grant Likely <[email protected]>

This allows platforms which don't have anything to do at setup_arch time (like a bunch of the 4xx platforms) to eliminate an empty setup_arch hook.

---

Can you add a comment to include/asm-powerpc/machdep.h to state that setup_arch() /* Optional, may be NULL */

We're a bit inconsistent here but would be good to make changes be correct.

- k