Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / drivers / s390 / char / con3215.c
index 022f17b..606f6ad 100644 (file)
 #include <linux/types.h>
 #include <linux/kdev_t.h>
 #include <linux/tty.h>
+#include <linux/tty_flip.h>
 #include <linux/vt_kern.h>
 #include <linux/init.h>
 #include <linux/console.h>
 #include <linux/interrupt.h>
+#include <linux/err.h>
 
 #include <linux/slab.h>
 #include <linux/bootmem.h>
@@ -432,8 +434,6 @@ raw3215_irq(struct ccw_device *cdev, unsigned long intparm, struct irb *irb)
                                if (count > slen)
                                        count = slen;
                        } else
-                       if (count >= TTY_FLIPBUF_SIZE - tty->flip.count)
-                               count = TTY_FLIPBUF_SIZE - tty->flip.count - 1;
                        EBCASC(raw->inbuf, count);
                        cchar = ctrlchar_handle(raw->inbuf, count, tty);
                        switch (cchar & CTRLCHAR_MASK) {
@@ -441,28 +441,20 @@ raw3215_irq(struct ccw_device *cdev, unsigned long intparm, struct irb *irb)
                                break;
 
                        case CTRLCHAR_CTRL:
-                               tty->flip.count++;
-                               *tty->flip.flag_buf_ptr++ = TTY_NORMAL;
-                               *tty->flip.char_buf_ptr++ = cchar;
+                               tty_insert_flip_char(tty, cchar, TTY_NORMAL);
                                tty_flip_buffer_push(raw->tty);
                                break;
 
                        case CTRLCHAR_NONE:
-                               memcpy(tty->flip.char_buf_ptr,
-                                      raw->inbuf, count);
                                if (count < 2 ||
-                                   (strncmp(raw->inbuf+count-2, "^n", 2) &&
-                                   strncmp(raw->inbuf+count-2, "\252n", 2)) ) {
-                                       /* don't add the auto \n */
-                                       tty->flip.char_buf_ptr[count] = '\n';
-                                       memset(tty->flip.flag_buf_ptr,
-                                              TTY_NORMAL, count + 1);
+                                   (strncmp(raw->inbuf+count-2, "\252n", 2) &&
+                                    strncmp(raw->inbuf+count-2, "^n", 2)) ) {
+                                       /* add the auto \n */
+                                       raw->inbuf[count] = '\n';
                                        count++;
                                } else
-                                       count-=2;
-                               tty->flip.char_buf_ptr += count;
-                               tty->flip.flag_buf_ptr += count;
-                               tty->flip.count += count;
+                                       count -= 2;
+                               tty_insert_flip_string(tty, raw->inbuf, count);
                                tty_flip_buffer_push(raw->tty);
                                break;
                        }
@@ -727,8 +719,7 @@ raw3215_remove (struct ccw_device *cdev)
        raw = cdev->dev.driver_data;
        if (raw) {
                cdev->dev.driver_data = NULL;
-               if (raw->buffer)
-                       kfree(raw->buffer);
+               kfree(raw->buffer);
                kfree(raw);
        }
 }
@@ -860,8 +851,8 @@ con3215_init(void)
 
        /* Set the console mode for VM */
        if (MACHINE_IS_VM) {
-               cpcmd("TERM CONMODE 3215", NULL, 0);
-               cpcmd("TERM AUTOCR OFF", NULL, 0);
+               cpcmd("TERM CONMODE 3215", NULL, 0, NULL);
+               cpcmd("TERM AUTOCR OFF", NULL, 0, NULL);
        }
 
        /* allocate 3215 request structures */
@@ -874,7 +865,7 @@ con3215_init(void)
        }
 
        cdev = ccw_device_probe_console();
-       if (!cdev)
+       if (IS_ERR(cdev))
                return -ENODEV;
 
        raw3215[0] = raw = (struct raw3215_info *)