* [PATCH 2/3] sparc32: cleanup code for irq init
@ 2011-04-18 21:25 Sam Ravnborg
2011-04-19 8:08 ` Daniel Hellstrom
2011-04-19 18:15 ` Sam Ravnborg
0 siblings, 2 replies; 3+ messages in thread
From: Sam Ravnborg @ 2011-04-18 21:25 UTC (permalink / raw)
To: sparclinux
Move the iddef to a header file to make the logic more
obvious in the .c file
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
arch/sparc/include/asm/pcic.h | 10 +++++++---
arch/sparc/kernel/irq_32.c | 9 +++------
2 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/arch/sparc/include/asm/pcic.h b/arch/sparc/include/asm/pcic.h
index f20ef56..b4c63d1 100644
--- a/arch/sparc/include/asm/pcic.h
+++ b/arch/sparc/include/asm/pcic.h
@@ -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. */
diff --git a/arch/sparc/kernel/irq_32.c b/arch/sparc/kernel/irq_32.c
index 7c93df4..b2dbb4b 100644
--- a/arch/sparc/kernel/irq_32.c
+++ b/arch/sparc/kernel/irq_32.c
@@ -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:
--
1.6.0.6
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 2/3] sparc32: cleanup code for irq init
2011-04-18 21:25 [PATCH 2/3] sparc32: cleanup code for irq init Sam Ravnborg
@ 2011-04-19 8:08 ` Daniel Hellstrom
2011-04-19 18:15 ` Sam Ravnborg
1 sibling, 0 replies; 3+ messages in thread
From: Daniel Hellstrom @ 2011-04-19 8:08 UTC (permalink / raw)
To: sparclinux
Sam Ravnborg wrote:
>Move the iddef to a header file to make the logic more
>obvious in the .c file
>
>Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
>---
> arch/sparc/include/asm/pcic.h | 10 +++++++---
> arch/sparc/kernel/irq_32.c | 9 +++------
> 2 files changed, 10 insertions(+), 9 deletions(-)
>
>diff --git a/arch/sparc/include/asm/pcic.h b/arch/sparc/include/asm/pcic.h
>index f20ef56..b4c63d1 100644
>--- a/arch/sparc/include/asm/pcic.h
>+++ b/arch/sparc/include/asm/pcic.h
>@@ -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; }
>
>
typo, it should be static inline int pcic_preset... will not compile
otherwise.
>+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. */
>diff --git a/arch/sparc/kernel/irq_32.c b/arch/sparc/kernel/irq_32.c
>index 7c93df4..b2dbb4b 100644
>--- a/arch/sparc/kernel/irq_32.c
>+++ b/arch/sparc/kernel/irq_32.c
>@@ -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:
>
>
Similarily you can add "static inline void pci_time_init(void) {};" and
remove the CONFIG_PCI in time_32.c?
Daniel
diff --git a/arch/sparc/kernel/time_32.c b/arch/sparc/kernel/time_32.c
index ffcf7b5..3db2b06 100644
--- a/arch/sparc/kernel/time_32.c
+++ b/arch/sparc/kernel/time_32.c
@@ -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");
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 2/3] sparc32: cleanup code for irq init
2011-04-18 21:25 [PATCH 2/3] sparc32: cleanup code for irq init Sam Ravnborg
2011-04-19 8:08 ` Daniel Hellstrom
@ 2011-04-19 18:15 ` Sam Ravnborg
1 sibling, 0 replies; 3+ messages in thread
From: Sam Ravnborg @ 2011-04-19 18:15 UTC (permalink / raw)
To: sparclinux
>> -
>> +#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.
>
>> +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. */
>> diff --git a/arch/sparc/kernel/irq_32.c b/arch/sparc/kernel/irq_32.c
>> index 7c93df4..b2dbb4b 100644
>> --- a/arch/sparc/kernel/irq_32.c
>> +++ b/arch/sparc/kernel/irq_32.c
>> @@ -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:
>>
>>
> 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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-04-19 18:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-18 21:25 [PATCH 2/3] sparc32: cleanup code for irq init Sam Ravnborg
2011-04-19 8:08 ` Daniel Hellstrom
2011-04-19 18:15 ` Sam Ravnborg
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.