Skip to contentSkip to conversation

2.4.9-pre[34] changes in drivers/char/vt.c broke Sparc64

DISCUSSION Maksim Krasnyanskiy 2 participants 2 messages Aug 15, 2001

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi,

Have you guys noticed that new vt.c in 2.4.9-pre[34] doesn't compile on Sparc64 (and Sparc32) ?

sparc64-linux-gcc -D__KERNEL__ -I/usr/src/linux/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fomit-frame-pointer -fno-strict-aliasing -fno-common -m64 -pipe -mno-fpu -mcpu=ultrasparc -mcmodel=medlow -ffixed-g4 -fcall-used-g5 -fcall-used-g7 -Wno-sign-compare -Wa,--undeclared-regs -c -o vt.o vt.c
In file included from vt.c:27:
/usr/src/linux/include/linux/irq.h:57: asm/hw_irq.h: No such file or directory vt.c: In function `vt_ioctl':
vt.c:507: `kbd_rate' undeclared (first use in this function) vt.c:507: (Each undeclared identifier is reported only once vt.c:507: for each function it appears in.)
vt.c:514: `kbd_rate' used prior to declaration
vt.c:514: warning: implicit declaration of function `kbd_rate'

Simple commenting out #include <linux/irq.h> and ioctl code that uses kbd_rate works. Whoever changed vt.c please post correct fix.

Thanks
Max

Maksim Krasnyanskiy
Senior Kernel Engineer
Qualcomm Incorporated

[email protected]
http://bluez.sf.net
http://vtun.sf.net

#1 lore raw
Quoted 13 lines · Maksim Krasnyanskiy

Have you guys noticed that new vt.c in 2.4.9-pre[34] doesn't compile on Sparc64 (and Sparc32) ?

sparc64-linux-gcc -D__KERNEL__ -I/usr/src/linux/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fomit-frame-pointer -fno-strict-aliasing -fno-common -m64 -pipe -mno-fpu -mcpu=ultrasparc -mcmodel=medlow -ffixed-g4 -fcall-used-g5 -fcall-used-g7 -Wno-sign-compare -Wa,--undeclared-regs -c -o vt.o vt.c
In file included from vt.c:27:
/usr/src/linux/include/linux/irq.h:57: asm/hw_irq.h: No such file or directory vt.c: In function `vt_ioctl':
vt.c:507: `kbd_rate' undeclared (first use in this function) vt.c:507: (Each undeclared identifier is reported only once vt.c:507: for each function it appears in.)
vt.c:514: `kbd_rate' used prior to declaration
vt.c:514: warning: implicit declaration of function `kbd_rate'

Quoted 2 lines

Simple commenting out #include <linux/irq.h> and ioctl code that uses kbd_rate works. Whoever changed vt.c please post correct fix.

I came across both of these in 2.4.8-ac. The best fix is non-obvious, and the code is very unclear.

Turns out the only reasonable way is to declare kbd_rate as a weak symbol in your asm/keyboard.h:

extern int kbd_rate(struct kbd_repeat *rate) __attribute__((weak));

Second thing is <linux/irq.h>. I strongly disagree with this change, (see the comments in linux/irq.h in this patch) and I've sent the following patch to Alan to fix this cockup.

drivers/char/sysrq.c +0 -1
diff -urN linux-orig/drivers/char/sysrq.c linux/drivers/char/sysrq.c
@@ -27,7 +27,6 @@
 #include <linux/quotaops.h>
 #include <linux/smp_lock.h>
 #include <linux/module.h>
-#include <linux/irq.h>
 
 #include <linux/spinlock.h>
 
drivers/char/vt.c +0 -1
diff -urN linux-orig/drivers/char/vt.c linux/drivers/char/vt.c
@@ -24,7 +24,6 @@
 #include <linux/major.h>
 #include <linux/fs.h>
 #include <linux/console.h>
-#include <linux/irq.h>
 
 #include <asm/io.h>
 #include <asm/uaccess.h>
include/asm-i386/irq.h +1 -1
diff -urN linux-orig/include/asm-i386/irq.h linux/include/asm-i386/irq.h
@@ -35,7 +35,7 @@
 extern void enable_irq(unsigned int);
 
 #ifdef CONFIG_X86_LOCAL_APIC
-#define ARCH_HAS_NMI_WATCHDOG		/* See include/linux/irq.h */
+#define ARCH_HAS_NMI_WATCHDOG		/* See include/linux/nmi.h */
 #endif
 
 #endif /* _ASM_IRQ_H */
include/linux/irq.h +8 -13
diff -urN linux-orig/include/linux/irq.h linux/include/linux/irq.h
@@ -1,6 +1,14 @@
 #ifndef __irq_h
 #define __irq_h
 
+/*
+ * Please do not include this file in generic code.  There is currently
+ * no requirement for any architecture to implement anything held
+ * within this file.
+ *
+ * Thanks. --rmk
+ */
+
 #include <linux/config.h>
 
 #if !defined(CONFIG_ARCH_S390)
@@ -59,19 +67,6 @@
 extern irq_desc_t irq_desc [NR_IRQS];
 
 #include <asm/hw_irq.h> /* the arch dependent stuff */
-
-/**
- * touch_nmi_watchdog - restart NMI watchdog timeout.
- * 
- * If the architecture supports the NMI watchdog, touch_nmi_watchdog()
- * may be used to reset the timeout - for code which intentionally
- * disables interrupts for a long time. This call is stateless.
- */
-#ifdef ARCH_HAS_NMI_WATCHDOG
-extern void touch_nmi_watchdog(void);
-#else
-# define touch_nmi_watchdog() do { } while(0)
-#endif
 
 extern int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *);
 extern int setup_irq(unsigned int , struct irqaction * );
include/linux/nmi.h +22 -0
diff -urN linux-orig/include/linux/nmi.h linux/include/linux/nmi.h
@@ -0,0 +1,22 @@
+/*
+ *  linux/include/linux/nmi.h
+ */
+#ifndef LINUX_NMI_H
+#define LINUX_NMI_H
+
+#include <asm/irq.h>
+
+/**
+ * touch_nmi_watchdog - restart NMI watchdog timeout.
+ * 
+ * If the architecture supports the NMI watchdog, touch_nmi_watchdog()
+ * may be used to reset the timeout - for code which intentionally
+ * disables interrupts for a long time. This call is stateless.
+ */
+#ifdef ARCH_HAS_NMI_WATCHDOG
+extern void touch_nmi_watchdog(void);
+#else
+# define touch_nmi_watchdog() do { } while(0)
+#endif
+
+#endif
kernel/sched.c +1 -1
diff -urN linux-orig/kernel/sched.c linux/kernel/sched.c
@@ -23,7 +23,7 @@
 #include <linux/mm.h>
 #include <linux/init.h>
 #include <linux/smp_lock.h>
-#include <linux/irq.h>
+#include <linux/nmi.h>
 #include <linux/interrupt.h>
 #include <linux/kernel_stat.h>
 #include <linux/completion.h>

--
Russell King ([email protected]) The developer of ARM Linux
http://www.arm.linux.org.uk/personal/aboutme.html