diff options
Diffstat (limited to 'drivers/s390/char')
-rw-r--r-- | drivers/s390/char/con3215.c | 25 | ||||
-rw-r--r-- | drivers/s390/char/sclp_tty.c | 21 | ||||
-rw-r--r-- | drivers/s390/char/sclp_vt220.c | 12 |
3 files changed, 18 insertions, 40 deletions
diff --git a/drivers/s390/char/con3215.c b/drivers/s390/char/con3215.c index 75419cf9d353..1f060914cfa4 100644 --- a/drivers/s390/char/con3215.c +++ b/drivers/s390/char/con3215.c @@ -16,6 +16,7 @@ #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> @@ -432,8 +433,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 +440,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; } diff --git a/drivers/s390/char/sclp_tty.c b/drivers/s390/char/sclp_tty.c index a20d7c89341d..6cbf067f1a8f 100644 --- a/drivers/s390/char/sclp_tty.c +++ b/drivers/s390/char/sclp_tty.c @@ -13,6 +13,7 @@ #include <linux/kmod.h> #include <linux/tty.h> #include <linux/tty_driver.h> +#include <linux/tty_flip.h> #include <linux/sched.h> #include <linux/wait.h> #include <linux/slab.h> @@ -496,25 +497,19 @@ sclp_tty_input(unsigned char* buf, unsigned int count) case CTRLCHAR_SYSRQ: break; case CTRLCHAR_CTRL: - sclp_tty->flip.count++; - *sclp_tty->flip.flag_buf_ptr++ = TTY_NORMAL; - *sclp_tty->flip.char_buf_ptr++ = cchar; + tty_insert_flip_char(sclp_tty, cchar, TTY_NORMAL); tty_flip_buffer_push(sclp_tty); break; case CTRLCHAR_NONE: /* send (normal) input to line discipline */ - memcpy(sclp_tty->flip.char_buf_ptr, buf, count); if (count < 2 || - (strncmp ((const char *) buf + count - 2, "^n", 2) && - strncmp ((const char *) buf + count - 2, "\0252n", 2))) { - sclp_tty->flip.char_buf_ptr[count] = '\n'; - count++; + (strncmp((const char *) buf + count - 2, "^n", 2) && + strncmp((const char *) buf + count - 2, "\252n", 2))) { + /* add the auto \n */ + tty_insert_flip_string(sclp_tty, buf, count); + tty_insert_flip_char(sclp_tty, '\n', TTY_NORMAL); } else - count -= 2; - memset(sclp_tty->flip.flag_buf_ptr, TTY_NORMAL, count); - sclp_tty->flip.char_buf_ptr += count; - sclp_tty->flip.flag_buf_ptr += count; - sclp_tty->flip.count += count; + tty_insert_flip_string(sclp_tty, buf, count - 2); tty_flip_buffer_push(sclp_tty); break; } diff --git a/drivers/s390/char/sclp_vt220.c b/drivers/s390/char/sclp_vt220.c index 06bd85824d7b..9e02625c82cf 100644 --- a/drivers/s390/char/sclp_vt220.c +++ b/drivers/s390/char/sclp_vt220.c @@ -16,6 +16,7 @@ #include <linux/kernel.h> #include <linux/tty.h> #include <linux/tty_driver.h> +#include <linux/tty_flip.h> #include <linux/sched.h> #include <linux/errno.h> #include <linux/mm.h> @@ -482,16 +483,7 @@ sclp_vt220_receiver_fn(struct evbuf_header *evbuf) /* Send input to line discipline */ buffer++; count--; - /* Prevent buffer overrun by discarding input. Note that - * because buffer_push works asynchronously, we cannot wait - * for the buffer to be emptied. */ - if (count + sclp_vt220_tty->flip.count > TTY_FLIPBUF_SIZE) - count = TTY_FLIPBUF_SIZE - sclp_vt220_tty->flip.count; - memcpy(sclp_vt220_tty->flip.char_buf_ptr, buffer, count); - memset(sclp_vt220_tty->flip.flag_buf_ptr, TTY_NORMAL, count); - sclp_vt220_tty->flip.char_buf_ptr += count; - sclp_vt220_tty->flip.flag_buf_ptr += count; - sclp_vt220_tty->flip.count += count; + tty_insert_flip_string(sclp_vt220_tty, buffer, count); tty_flip_buffer_push(sclp_vt220_tty); break; } |