[POWERPC] iSeries: Remove unused mail address
[pandora-kernel.git] / drivers / char / viocons.c
index 6d2e314..65fb848 100644 (file)
@@ -7,7 +7,7 @@
  *  Authors: Dave Boutcher <boutcher@us.ibm.com>
  *           Ryan Arnold <ryanarn@us.ibm.com>
  *           Colin Devilbiss <devilbis@us.ibm.com>
- *           Stephen Rothwell <sfr@au1.ibm.com>
+ *           Stephen Rothwell
  *
  * (C) Copyright 2000, 2001, 2002, 2003, 2004 IBM Corporation
  *
@@ -42,6 +42,7 @@
 #include <linux/tty_flip.h>
 #include <linux/sysrq.h>
 
+#include <asm/firmware.h>
 #include <asm/iseries/vio.h>
 #include <asm/iseries/hv_lp_event.h>
 #include <asm/iseries/hv_call_event.h>
 static DEFINE_SPINLOCK(consolelock);
 static DEFINE_SPINLOCK(consoleloglock);
 
-#ifdef CONFIG_MAGIC_SYSRQ
 static int vio_sysrq_pressed;
-extern int sysrq_enabled;
-#endif
 
 #define VIOCHAR_NUM_BUF                16
 
@@ -630,13 +628,13 @@ static int viotty_write(struct tty_struct *tty, const unsigned char *buf,
 /*
  * TTY put_char method
  */
-static void viotty_put_char(struct tty_struct *tty, unsigned char ch)
+static int viotty_put_char(struct tty_struct *tty, unsigned char ch)
 {
        struct port_info *pi;
 
        pi = get_port_data(tty);
        if (pi == NULL)
-               return;
+               return 0;
 
        /* This will append '\r' as well if the char is '\n' */
        if (viochar_is_console(pi))
@@ -644,6 +642,7 @@ static void viotty_put_char(struct tty_struct *tty, unsigned char ch)
 
        if (viopath_isactive(pi->lp))
                internal_write(pi, &ch, 1);
+       return 1;
 }
 
 /*
@@ -706,8 +705,11 @@ static int viotty_ioctl(struct tty_struct *tty, struct file *file,
        case KDSKBLED:
                return 0;
        }
-
-       return n_tty_ioctl(tty, file, cmd, arg);
+       /* FIXME: WTF is this being called for ??? */
+       lock_kernel();
+       ret =  n_tty_ioctl(tty, file, cmd, arg);
+       unlock_kernel();
+       return ret;
 }
 
 /*
@@ -936,8 +938,10 @@ static void vioHandleData(struct HvLpEvent *event)
         */
        num_pushed = 0;
        for (index = 0; index < cevent->len; index++) {
-#ifdef CONFIG_MAGIC_SYSRQ
-               if (sysrq_enabled) {
+               /*
+                * Will be optimized away if !CONFIG_MAGIC_SYSRQ:
+                */
+               if (sysrq_on()) {
                        /* 0x0f is the ascii character for ^O */
                        if (cevent->data[index] == '\x0f') {
                                vio_sysrq_pressed = 1;
@@ -956,7 +960,6 @@ static void vioHandleData(struct HvLpEvent *event)
                                continue;
                        }
                }
-#endif
                /*
                 * The sysrq sequence isn't included in this check if
                 * sysrq is enabled and compiled into the kernel because
@@ -1062,6 +1065,9 @@ static int __init viocons_init2(void)
        atomic_t wait_flag;
        int rc;
 
+       if (!firmware_has_feature(FW_FEATURE_ISERIES))
+               return -ENODEV;
+
        /* +2 for fudge */
        rc = viopath_open(HvLpConfig_getPrimaryLpIndex(),
                        viomajorsubtype_chario, VIOCHAR_WINDOW + 2);
@@ -1147,6 +1153,9 @@ static int __init viocons_init(void)
 {
        int i;
 
+       if (!firmware_has_feature(FW_FEATURE_ISERIES))
+               return -ENODEV;
+
        printk(VIOCONS_KERN_INFO "registering console\n");
        for (i = 0; i < VTTY_PORTS; i++) {
                port_info[i].lp = HvLpIndexInvalid;