Skip to contentSkip to conversation

sparc32: cleanup code for irq init

PATCH Applied Sam Ravnborg 2 participants 3 messages Apr 18, 2011 – Apr 19, 2011 SPARC + UltraSPARC (sparc/sparc64)

lore
Share & tools
lore
#0 lore raw

PATCH 2/3 sparc32: cleanup code for irq init

Move the iddef to a header file to make the logic more obvious in the .c file

---
 arch/sparc/include/asm/pcic.h |   10 +++++++---
 arch/sparc/kernel/irq_32.c    |    9 +++------
 2 files changed, 10 insertions(+), 9 deletions(-)
arch/sparc/include/asm/pcic.h +7 -3
index f20ef56..b4c63d1 100644
@@ -29,11 +29,15 @@ struct linux_pcic {
 	int			pcic_imdim;
 };
 
-extern int pcic_probe(void);
-/* Erm... MJ redefined pcibios_present() so that it does not work early. */
+#ifdef CONFIG_PCI
 extern int pcic_present(void);
+extern int pcic_probe(void);
 extern void sun4m_pci_init_IRQ(void);
-
+#else
+extern int pcic_present(void) { return 0; }
+static inline int pcic_probe(void) { return 0; }
+static inline void sun4m_pci_init_IRQ(void) {}
+#endif
 #endif
 
 /* Size of PCI I/O space which we relocate. */
arch/sparc/kernel/irq_32.c +3 -6
index 7c93df4..b2dbb4b 100644
@@ -607,14 +607,11 @@ void __init init_IRQ(void)
 		break;
 
 	case sun4m:
-#ifdef CONFIG_PCI
 		pcic_probe();
-		if (pcic_present()) {
+		if (pcic_present())
 			sun4m_pci_init_IRQ();
-			break;
-		}
-#endif
-		sun4m_init_IRQ();
+		else
+			sun4m_init_IRQ();
 		break;
 
 	case sun4d:
Signature · 1 line
1.6.0.6
#1 lore raw
Quoted 18 lines · Sam Ravnborg

Move the iddef to a header file to make the logic more obvious in the .c file

---
arch/sparc/include/asm/pcic.h | 10 +++++++---
arch/sparc/kernel/irq_32.c | 9 +++------

2 files changed, 10 insertions(+), 9 deletions(-)
arch/sparc/include/asm/pcic.h +0 -1
index f20ef56..b4c63d1 100644
@@ -29,11 +29,15 @@ struct linux_pcic {
 	int			pcic_imdim;
 };
 
-extern int pcic_probe(void);

arch/sparc/include/asm/pcic.h struct linux_pcic { · line 39

Quoted 10 lines
arch/sparc/include/asm/pcic.h +4 -2
-/* Erm... MJ redefined pcibios_present() so that it does not work early. */
+#ifdef CONFIG_PCI
 extern int pcic_present(void);
+extern int pcic_probe(void);
 extern void sun4m_pci_init_IRQ(void);
-
+#else
+extern int pcic_present(void) { return 0; }
 
 

typo, it should be static inline int pcic_preset... will not compile otherwise.

Quoted 20 lines
arch/sparc/include/asm/pcic.h +3 -0
+static inline int pcic_probe(void) { return 0; }
+static inline void sun4m_pci_init_IRQ(void) {}
+#endif
 #endif

/* Size of PCI I/O space which we relocate. */

arch/sparc/kernel/irq_32.c +1 -2
index 7c93df4..b2dbb4b 100644
@@ -607,14 +607,11 @@ void __init init_IRQ(void)
 		break;
 
 	case sun4m:
-#ifdef CONFIG_PCI
 		pcic_probe();
-		if (pcic_present()) {
+		if (pcic_present())

arch/sparc/kernel/irq_32.c void __init init_IRQ(void) · line 617

Quoted 10 lines
arch/sparc/kernel/irq_32.c +2 -4
 			sun4m_pci_init_IRQ();
-			break;
-		}
-#endif
-		sun4m_init_IRQ();
+		else
+			sun4m_init_IRQ();
 		break;
 
 	case sun4d:

Similarily you can add "static inline void pci_time_init(void) {};" and remove the CONFIG_PCI in time_32.c?

Daniel

arch/sparc/kernel/time_32.c +0 -4
index ffcf7b5..3db2b06 100644
@@ -228,17 +228,13 @@ static void __init sbus_time_init(void)
 
 void __init time_init(void)
 {
-#ifdef CONFIG_PCI
-       extern void pci_time_init(void);
        if (pcic_present()) {
                pci_time_init();
                return;
        }
-#endif
        sbus_time_init();
 }
 
-
 static int set_rtc_mmss(unsigned long secs)
 {
        struct rtc_device *rtc = rtc_class_open("rtc0");
#2 lore raw
In reply to Sam Ravnborg
Quoted 7 lines

arch/sparc/include/asm/pcic.h struct linux_pcic { · line 37

Quoted 5 lines
arch/sparc/include/asm/pcic.h +2 -1
-
+#else
+extern int pcic_present(void) { return 0; }

typo, it should be static inline int pcic_preset... will not compile otherwise.

Obviously not testet without PCI defined.

Quoted 28 lines
Quoted 28 lines
arch/sparc/include/asm/pcic.h +3 -0
+static inline int pcic_probe(void) { return 0; }
+static inline void sun4m_pci_init_IRQ(void) {}
+#endif

#endif

/* Size of PCI I/O space which we relocate. */

arch/sparc/kernel/irq_32.c +3 -6
index 7c93df4..b2dbb4b 100644
@@ -607,14 +607,11 @@ void __init init_IRQ(void)
 		break;
 
 	case sun4m:
-#ifdef CONFIG_PCI
 		pcic_probe();
-		if (pcic_present()) {
+		if (pcic_present())
 			sun4m_pci_init_IRQ();
-			break;
-		}
-#endif
-		sun4m_init_IRQ();
+		else
+			sun4m_init_IRQ();
 		break;
 
Quoted 5 lines

arch/sparc/kernel/irq_32.c void __init init_IRQ(void) · line 617

Quoted 3 lines
arch/sparc/kernel/irq_32.c +0 -0
 	case sun4d:

Similarily you can add "static inline void pci_time_init(void) {};" and remove the CONFIG_PCI in time_32.c?

Yes - will do so.

Thanks.
Sam