This commit was manufactured by cvs2svn to create tag
[linux-2.6.git] / drivers / s390 / char / con3215.c
index e74554b..9c72ffb 100644 (file)
@@ -983,16 +983,35 @@ tty3215_write_room(struct tty_struct *tty)
  * String write routine for 3215 ttys
  */
 static int
-tty3215_write(struct tty_struct * tty,
+tty3215_write(struct tty_struct * tty, int from_user,
              const unsigned char *buf, int count)
 {
        struct raw3215_info *raw;
+       int length, ret;
 
        if (!tty)
                return 0;
        raw = (struct raw3215_info *) tty->driver_data;
-       raw3215_write(raw, buf, count);
-       return count;
+       if (!from_user) {
+               raw3215_write(raw, buf, count);
+               return count;
+       }
+       ret = 0;
+       while (count > 0) {
+               length = count < 80 ? count : 80;
+               length -= copy_from_user(raw->ubuffer,
+                               (const unsigned char __user *)buf, length);
+               if (length == 0) {
+                       if (!ret)
+                               ret = -EFAULT;
+                       break;
+               }
+               raw3215_write(raw, raw->ubuffer, count);
+               buf += length;
+               count -= length;
+               ret += length;
+       }
+       return ret;
 }
 
 /*