]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - arch/parisc/kernel/pdc_cons.c
[PARISC] pdc_console: fix bizarre panic on boot
[net-next-2.6.git] / arch / parisc / kernel / pdc_cons.c
index 215d78c87bc515d2e5142de76430dbd9bc468b9f..ccb68090781efdc24b553ce9e6162899ed349c03 100644 (file)
@@ -44,7 +44,6 @@
 #define EARLY_BOOTUP_DEBUG
 
 
-#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/console.h>
 #include <linux/string.h>
 #include <linux/tty.h>
 #include <asm/pdc.h>           /* for iodc_call() proto and friends */
 
+static spinlock_t pdc_console_lock = SPIN_LOCK_UNLOCKED;
 
 static void pdc_console_write(struct console *co, const char *s, unsigned count)
 {
-       while(count--)
-               pdc_iodc_putc(*s++);
+       int i = 0;
+       unsigned long flags;
+
+       spin_lock_irqsave(&pdc_console_lock, flags);
+       do {
+               i += pdc_iodc_print(s + i, count - i);
+       } while (i < count);
+       spin_unlock_irqrestore(&pdc_console_lock, flags);
 }
 
-void pdc_outc(unsigned char c)
-{
-       pdc_iodc_outc(c);
-}
-
-void pdc_printf(const char *fmt, ...)
+int pdc_console_poll_key(struct console *co)
 {
-       va_list args;
-       char buf[1024];
-       int i, len;
+       int c;
+       unsigned long flags;
 
-       va_start(args, fmt);
-       len = vscnprintf(buf, sizeof(buf), fmt, args);
-       va_end(args);
+       spin_lock_irqsave(&pdc_console_lock, flags);
+       c = pdc_iodc_getc();
+       spin_unlock_irqrestore(&pdc_console_lock, flags);
 
-       for (i = 0; i < len; i++)
-               pdc_iodc_outc(buf[i]);
-}
-
-int pdc_console_poll_key(struct console *co)
-{
-       return pdc_iodc_getc();
+       return c;
 }
 
 static int pdc_console_setup(struct console *co, char *options)
@@ -90,6 +84,8 @@ static int pdc_console_setup(struct console *co, char *options)
 }
 
 #if defined(CONFIG_PDC_CONSOLE)
+#include <linux/vt_kern.h>
+
 static struct tty_driver * pdc_console_device (struct console *c, int *index)
 {
        extern struct tty_driver console_driver;