vserver 1.9.5.x5
[linux-2.6.git] / drivers / s390 / char / tty3270.c
index debc2b0..7db5ebc 100644 (file)
@@ -124,16 +124,13 @@ void
 tty3270_set_timer(struct tty3270 *tp, int expires)
 {
        if (expires == 0) {
-               if (timer_pending(&tp->timer)) {
+               if (timer_pending(&tp->timer) && del_timer(&tp->timer))
                        raw3270_put_view(&tp->view);
-                       del_timer(&tp->timer);
-               }
                return;
        }
-       if (timer_pending(&tp->timer)) {
-               if (mod_timer(&tp->timer, jiffies + expires))
-                       return;
-       }
+       if (timer_pending(&tp->timer) &&
+           mod_timer(&tp->timer, jiffies + expires))
+               return;
        raw3270_get_view(&tp->view);
        tp->timer.function = (void (*)(unsigned long)) tty3270_update;
        tp->timer.data = (unsigned long) tp;
@@ -709,6 +706,7 @@ tty3270_alloc_view(void)
        if (!tp->freemem_pages)
                goto out_tp;
        INIT_LIST_HEAD(&tp->freemem);
+       init_timer(&tp->timer);
        for (pages = 0; pages < TTY3270_STRING_PAGES; pages++) {
                tp->freemem_pages[pages] = (void *)
                        __get_free_pages(GFP_KERNEL|GFP_DMA, 0);
@@ -1599,11 +1597,10 @@ tty3270_do_write(struct tty3270 *tp, const unsigned char *buf, int count)
  * String write routine for 3270 ttys
  */
 static int
-tty3270_write(struct tty_struct * tty, int from_user,
+tty3270_write(struct tty_struct * tty,
              const unsigned char *buf, int count)
 {
        struct tty3270 *tp;
-       int length, ret;
 
        tp = tty->driver_data;
        if (!tp)
@@ -1612,26 +1609,8 @@ tty3270_write(struct tty_struct * tty, int from_user,
                tty3270_do_write(tp, tp->char_buf, tp->char_count);
                tp->char_count = 0;
        }
-       if (!from_user) {
-               tty3270_do_write(tp, buf, count);
-               return count;
-       }
-       ret = 0;
-       while (count > 0) {
-               length = count < TTY3270_CHAR_BUF_SIZE ?
-                       count : TTY3270_CHAR_BUF_SIZE;
-               length -= copy_from_user(tp->char_buf, buf, length);
-               if (length == 0) {
-                       if (!ret)
-                               ret = -EFAULT;
-                       break;
-               }
-               tty3270_do_write(tp, tp->char_buf, count);
-               buf += length;
-               count -= length;
-               ret += length;
-       }
-       return ret;
+       tty3270_do_write(tp, buf, count);
+       return count;
 }
 
 /*