aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/net/ctctty.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/s390/net/ctctty.c')
-rw-r--r--drivers/s390/net/ctctty.c28
1 files changed, 7 insertions, 21 deletions
diff --git a/drivers/s390/net/ctctty.c b/drivers/s390/net/ctctty.c
index 968f2c113efe..93d1725eb79b 100644
--- a/drivers/s390/net/ctctty.c
+++ b/drivers/s390/net/ctctty.c
@@ -25,6 +25,7 @@
25#include <linux/config.h> 25#include <linux/config.h>
26#include <linux/module.h> 26#include <linux/module.h>
27#include <linux/tty.h> 27#include <linux/tty.h>
28#include <linux/tty_flip.h>
28#include <linux/serial_reg.h> 29#include <linux/serial_reg.h>
29#include <linux/interrupt.h> 30#include <linux/interrupt.h>
30#include <linux/delay.h> 31#include <linux/delay.h>
@@ -101,25 +102,17 @@ static spinlock_t ctc_tty_lock;
101static int 102static int
102ctc_tty_try_read(ctc_tty_info * info, struct sk_buff *skb) 103ctc_tty_try_read(ctc_tty_info * info, struct sk_buff *skb)
103{ 104{
104 int c;
105 int len; 105 int len;
106 struct tty_struct *tty; 106 struct tty_struct *tty;
107 107
108 DBF_TEXT(trace, 5, __FUNCTION__); 108 DBF_TEXT(trace, 5, __FUNCTION__);
109 if ((tty = info->tty)) { 109 if ((tty = info->tty)) {
110 if (info->mcr & UART_MCR_RTS) { 110 if (info->mcr & UART_MCR_RTS) {
111 c = TTY_FLIPBUF_SIZE - tty->flip.count;
112 len = skb->len; 111 len = skb->len;
113 if (c >= len) { 112 tty_insert_flip_string(tty, skb->data, len);
114 memcpy(tty->flip.char_buf_ptr, skb->data, len); 113 tty_flip_buffer_push(tty);
115 memset(tty->flip.flag_buf_ptr, 0, len); 114 kfree_skb(skb);
116 tty->flip.count += len; 115 return 1;
117 tty->flip.char_buf_ptr += len;
118 tty->flip.flag_buf_ptr += len;
119 tty_flip_buffer_push(tty);
120 kfree_skb(skb);
121 return 1;
122 }
123 } 116 }
124 } 117 }
125 return 0; 118 return 0;
@@ -138,19 +131,12 @@ ctc_tty_readmodem(ctc_tty_info *info)
138 DBF_TEXT(trace, 5, __FUNCTION__); 131 DBF_TEXT(trace, 5, __FUNCTION__);
139 if ((tty = info->tty)) { 132 if ((tty = info->tty)) {
140 if (info->mcr & UART_MCR_RTS) { 133 if (info->mcr & UART_MCR_RTS) {
141 int c = TTY_FLIPBUF_SIZE - tty->flip.count;
142 struct sk_buff *skb; 134 struct sk_buff *skb;
143 135
144 if ((c > 0) && (skb = skb_dequeue(&info->rx_queue))) { 136 if ((skb = skb_dequeue(&info->rx_queue))) {
145 int len = skb->len; 137 int len = skb->len;
146 if (len > c) 138 tty_insert_flip_string(tty, skb->data, len);
147 len = c;
148 memcpy(tty->flip.char_buf_ptr, skb->data, len);
149 skb_pull(skb, len); 139 skb_pull(skb, len);
150 memset(tty->flip.flag_buf_ptr, 0, len);
151 tty->flip.count += len;
152 tty->flip.char_buf_ptr += len;
153 tty->flip.flag_buf_ptr += len;
154 tty_flip_buffer_push(tty); 140 tty_flip_buffer_push(tty);
155 if (skb->len > 0) 141 if (skb->len > 0)
156 skb_queue_head(&info->rx_queue, skb); 142 skb_queue_head(&info->rx_queue, skb);