aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2005-05-09 18:21:59 -0400
committerRussell King <rmk@dyn-67.arm.linux.org.uk>2005-05-09 18:21:59 -0400
commit05ab3014636ff60a319d37cdf37dca594b015eec (patch)
treed9d948a5ecd5e10cd511ebca328df2ef08d5e076 /drivers/serial
parent88d7bd8cb9eb8d64bf7997600b0d64f7834047c5 (diff)
[PATCH] Serial: Add uart_insert_char()
Add uart_insert_char(), which handles inserting characters into the flip buffer. This helper function handles the correct semantics for handling overrun in addition to inserting normal characters. Signed-off-by: Russell King <rmk@arm.linux.org.uk>
Diffstat (limited to 'drivers/serial')
-rw-r--r--drivers/serial/21285.c14
-rw-r--r--drivers/serial/8250.c15
-rw-r--r--drivers/serial/amba-pl010.c14
-rw-r--r--drivers/serial/amba-pl011.c14
-rw-r--r--drivers/serial/clps711x.c5
-rw-r--r--drivers/serial/pxa.c16
-rw-r--r--drivers/serial/s3c2410.c15
-rw-r--r--drivers/serial/sa1100.c5
-rw-r--r--drivers/serial/serial_lh7a40x.c13
-rw-r--r--drivers/serial/serial_txx9.c15
-rw-r--r--drivers/serial/vr41xx_siu.c6
11 files changed, 22 insertions, 110 deletions
diff --git a/drivers/serial/21285.c b/drivers/serial/21285.c
index 33fbda79f35..0b10169961e 100644
--- a/drivers/serial/21285.c
+++ b/drivers/serial/21285.c
@@ -126,18 +126,8 @@ static irqreturn_t serial21285_rx_chars(int irq, void *dev_id, struct pt_regs *r
126 flag = TTY_FRAME; 126 flag = TTY_FRAME;
127 } 127 }
128 128
129 if ((rxs & port->ignore_status_mask) == 0) { 129 uart_insert_char(port, rxs, RXSTAT_OVERRUN, ch, flag);
130 tty_insert_flip_char(tty, ch, flag); 130
131 }
132 if ((rxs & RXSTAT_OVERRUN) &&
133 tty->flip.count < TTY_FLIPBUF_SIZE) {
134 /*
135 * Overrun is special, since it's reported
136 * immediately, and doesn't affect the current
137 * character.
138 */
139 tty_insert_flip_char(tty, 0, TTY_OVERRUN);
140 }
141 status = *CSR_UARTFLG; 131 status = *CSR_UARTFLG;
142 } 132 }
143 tty_flip_buffer_push(tty); 133 tty_flip_buffer_push(tty);
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index 0d9358608fd..3bbf0cc6e53 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -1122,18 +1122,9 @@ receive_chars(struct uart_8250_port *up, int *status, struct pt_regs *regs)
1122 } 1122 }
1123 if (uart_handle_sysrq_char(&up->port, ch, regs)) 1123 if (uart_handle_sysrq_char(&up->port, ch, regs))
1124 goto ignore_char; 1124 goto ignore_char;
1125 if ((lsr & up->port.ignore_status_mask) == 0) { 1125
1126 tty_insert_flip_char(tty, ch, flag); 1126 uart_insert_char(&up->port, lsr, UART_LSR_OE, ch, flag);
1127 } 1127
1128 if ((lsr & UART_LSR_OE) &&
1129 tty->flip.count < TTY_FLIPBUF_SIZE) {
1130 /*
1131 * Overrun is special, since it's reported
1132 * immediately, and doesn't affect the current
1133 * character.
1134 */
1135 tty_insert_flip_char(tty, 0, TTY_OVERRUN);
1136 }
1137 ignore_char: 1128 ignore_char:
1138 lsr = serial_inp(up, UART_LSR); 1129 lsr = serial_inp(up, UART_LSR);
1139 } while ((lsr & UART_LSR_DR) && (max_count-- > 0)); 1130 } while ((lsr & UART_LSR_DR) && (max_count-- > 0));
diff --git a/drivers/serial/amba-pl010.c b/drivers/serial/amba-pl010.c
index f2a5e2933c4..2884b310e54 100644
--- a/drivers/serial/amba-pl010.c
+++ b/drivers/serial/amba-pl010.c
@@ -198,18 +198,8 @@ pl010_rx_chars(struct uart_port *port)
198 if (uart_handle_sysrq_char(port, ch, regs)) 198 if (uart_handle_sysrq_char(port, ch, regs))
199 goto ignore_char; 199 goto ignore_char;
200 200
201 if ((rsr & port->ignore_status_mask) == 0) { 201 uart_insert_char(port, rsr, UART01x_RSR_OE, ch, flag);
202 tty_insert_flip_char(tty, ch, flag); 202
203 }
204 if ((rsr & UART01x_RSR_OE) &&
205 tty->flip.count < TTY_FLIPBUF_SIZE) {
206 /*
207 * Overrun is special, since it's reported
208 * immediately, and doesn't affect the current
209 * character
210 */
211 tty_insert_flip_char(tty, 0, TTY_OVERRUN);
212 }
213 ignore_char: 203 ignore_char:
214 status = UART_GET_FR(port); 204 status = UART_GET_FR(port);
215 } 205 }
diff --git a/drivers/serial/amba-pl011.c b/drivers/serial/amba-pl011.c
index d5cbef3fe8b..7db88ee18f7 100644
--- a/drivers/serial/amba-pl011.c
+++ b/drivers/serial/amba-pl011.c
@@ -163,18 +163,8 @@ pl011_rx_chars(struct uart_amba_port *uap)
163 if (uart_handle_sysrq_char(&uap->port, ch, regs)) 163 if (uart_handle_sysrq_char(&uap->port, ch, regs))
164 goto ignore_char; 164 goto ignore_char;
165 165
166 if ((rsr & uap->port.ignore_status_mask) == 0) { 166 uart_insert_char(&uap->port, rsr, UART01x_RSR_OE, ch, flag);
167 tty_insert_flip_char(tty, ch, flag); 167
168 }
169 if ((rsr & UART01x_RSR_OE) &&
170 tty->flip.count < TTY_FLIPBUF_SIZE) {
171 /*
172 * Overrun is special, since it's reported
173 * immediately, and doesn't affect the current
174 * character
175 */
176 tty_insert_flip_char(tty, 0, TTY_OVERRUN);
177 }
178 ignore_char: 168 ignore_char:
179 status = readw(uap->port.membase + UART01x_FR); 169 status = readw(uap->port.membase + UART01x_FR);
180 } 170 }
diff --git a/drivers/serial/clps711x.c b/drivers/serial/clps711x.c
index 6242f3090a9..e92522b33c4 100644
--- a/drivers/serial/clps711x.c
+++ b/drivers/serial/clps711x.c
@@ -143,10 +143,7 @@ static irqreturn_t clps711xuart_int_rx(int irq, void *dev_id, struct pt_regs *re
143 * CHECK: does overrun affect the current character? 143 * CHECK: does overrun affect the current character?
144 * ASSUMPTION: it does not. 144 * ASSUMPTION: it does not.
145 */ 145 */
146 if ((ch & port->ignore_status_mask & ~RXSTAT_OVERRUN) == 0) 146 uart_insert_char(port, ch, UARTDR_OVERR, ch, flg);
147 tty_insert_flip_char(tty, ch, flg);
148 if ((ch & ~port->ignore_status_mask & RXSTAT_OVERRUN) == 0)
149 tty_insert_flip_char(tty, 0, TTY_OVERRUN);
150 147
151 ignore_char: 148 ignore_char:
152 status = clps_readl(SYSFLG(port)); 149 status = clps_readl(SYSFLG(port));
diff --git a/drivers/serial/pxa.c b/drivers/serial/pxa.c
index 51d8a49f447..9dc151d8fa6 100644
--- a/drivers/serial/pxa.c
+++ b/drivers/serial/pxa.c
@@ -161,20 +161,12 @@ receive_chars(struct uart_pxa_port *up, int *status, struct pt_regs *regs)
161 else if (*status & UART_LSR_FE) 161 else if (*status & UART_LSR_FE)
162 flag = TTY_FRAME; 162 flag = TTY_FRAME;
163 } 163 }
164
164 if (uart_handle_sysrq_char(&up->port, ch, regs)) 165 if (uart_handle_sysrq_char(&up->port, ch, regs))
165 goto ignore_char; 166 goto ignore_char;
166 if ((*status & up->port.ignore_status_mask) == 0) { 167
167 tty_insert_flip_char(tty, ch, flag); 168 uart_insert_char(&up->port, *status, UART_LSR_OE, ch, flag);
168 } 169
169 if ((*status & UART_LSR_OE) &&
170 tty->flip.count < TTY_FLIPBUF_SIZE) {
171 /*
172 * Overrun is special, since it's reported
173 * immediately, and doesn't affect the current
174 * character.
175 */
176 tty_insert_flip_char(tty, 0, TTY_OVERRUN);
177 }
178 ignore_char: 170 ignore_char:
179 *status = serial_in(up, UART_LSR); 171 *status = serial_in(up, UART_LSR);
180 } while ((*status & UART_LSR_DR) && (max_count-- > 0)); 172 } while ((*status & UART_LSR_DR) && (max_count-- > 0));
diff --git a/drivers/serial/s3c2410.c b/drivers/serial/s3c2410.c
index 435750d40a4..2a9f7ade2c9 100644
--- a/drivers/serial/s3c2410.c
+++ b/drivers/serial/s3c2410.c
@@ -394,20 +394,7 @@ s3c24xx_serial_rx_chars(int irq, void *dev_id, struct pt_regs *regs)
394 if (uart_handle_sysrq_char(port, ch, regs)) 394 if (uart_handle_sysrq_char(port, ch, regs))
395 goto ignore_char; 395 goto ignore_char;
396 396
397 if ((uerstat & port->ignore_status_mask) == 0) { 397 uart_insert_char(port, uerstat, S3C2410_UERSTAT_OVERRUN, ch, flag);
398 tty_insert_flip_char(tty, ch, flag);
399 }
400
401 if ((uerstat & S3C2410_UERSTAT_OVERRUN) &&
402 tty->flip.count < TTY_FLIPBUF_SIZE) {
403 /*
404 * Overrun is special, since it's reported
405 * immediately, and doesn't affect the current
406 * character.
407 */
408
409 tty_insert_flip_char(tty, 0, TTY_OVERRUN);
410 }
411 398
412 ignore_char: 399 ignore_char:
413 continue; 400 continue;
diff --git a/drivers/serial/sa1100.c b/drivers/serial/sa1100.c
index 157218bc6c6..22565a67a57 100644
--- a/drivers/serial/sa1100.c
+++ b/drivers/serial/sa1100.c
@@ -237,10 +237,7 @@ sa1100_rx_chars(struct sa1100_port *sport, struct pt_regs *regs)
237 if (uart_handle_sysrq_char(&sport->port, ch, regs)) 237 if (uart_handle_sysrq_char(&sport->port, ch, regs))
238 goto ignore_char; 238 goto ignore_char;
239 239
240 if ((status & port->ignore_status_mask & ~UTSR1_TO_SM(UTSR1_ROR)) == 0) 240 uart_insert_char(&sport->port, status, UTSR1_TO_SM(UTSR1_ROR), ch, flg);
241 tty_insert_flip_char(tty, ch, flg);
242 if (status & ~port->ignore_status_mask & UTSR1_TO_SM(UTSR1_ROR))
243 tty_insert_flip_char(tty, 0, TTY_OVERRUN);
244 241
245 ignore_char: 242 ignore_char:
246 status = UTSR1_TO_SM(UART_GET_UTSR1(sport)) | 243 status = UTSR1_TO_SM(UART_GET_UTSR1(sport)) |
diff --git a/drivers/serial/serial_lh7a40x.c b/drivers/serial/serial_lh7a40x.c
index 85cfa08d3ba..56f269b6bfb 100644
--- a/drivers/serial/serial_lh7a40x.c
+++ b/drivers/serial/serial_lh7a40x.c
@@ -190,18 +190,7 @@ lh7a40xuart_rx_chars (struct uart_port* port)
190 if (uart_handle_sysrq_char (port, (unsigned char) data, regs)) 190 if (uart_handle_sysrq_char (port, (unsigned char) data, regs))
191 continue; 191 continue;
192 192
193 if ((data & port->ignore_status_mask) == 0) { 193 uart_insert_char(port, data, RxOverrunError, data, flag);
194 tty_insert_flip_char(tty, data, flag);
195 }
196 if ((data & RxOverrunError)
197 && tty->flip.count < TTY_FLIPBUF_SIZE) {
198 /*
199 * Overrun is special, since it's reported
200 * immediately, and doesn't affect the current
201 * character
202 */
203 tty_insert_flip_char(tty, 0, TTY_OVERRUN);
204 }
205 } 194 }
206 tty_flip_buffer_push (tty); 195 tty_flip_buffer_push (tty);
207 return; 196 return;
diff --git a/drivers/serial/serial_txx9.c b/drivers/serial/serial_txx9.c
index 37b2ef297cb..3f1051a4a13 100644
--- a/drivers/serial/serial_txx9.c
+++ b/drivers/serial/serial_txx9.c
@@ -350,18 +350,9 @@ receive_chars(struct uart_txx9_port *up, unsigned int *status, struct pt_regs *r
350 } 350 }
351 if (uart_handle_sysrq_char(&up->port, ch, regs)) 351 if (uart_handle_sysrq_char(&up->port, ch, regs))
352 goto ignore_char; 352 goto ignore_char;
353 if ((disr & up->port.ignore_status_mask) == 0) { 353
354 tty_insert_flip_char(tty, ch, flag); 354 uart_insert_char(&up->port, disr, TXX9_SIDISR_UOER, ch, flag);
355 } 355
356 if ((disr & TXX9_SIDISR_UOER) &&
357 tty->flip.count < TTY_FLIPBUF_SIZE) {
358 /*
359 * Overrun is special, since it's reported
360 * immediately, and doesn't affect the current
361 * character.
362 */
363 tty_insert_flip_char(tty, 0, TTY_OVERRUN);
364 }
365 ignore_char: 356 ignore_char:
366 disr = sio_in(up, TXX9_SIDISR); 357 disr = sio_in(up, TXX9_SIDISR);
367 } while (!(disr & TXX9_SIDISR_UVALID) && (max_count-- > 0)); 358 } while (!(disr & TXX9_SIDISR_UVALID) && (max_count-- > 0));
diff --git a/drivers/serial/vr41xx_siu.c b/drivers/serial/vr41xx_siu.c
index 307886199f2..5d2ceb623e6 100644
--- a/drivers/serial/vr41xx_siu.c
+++ b/drivers/serial/vr41xx_siu.c
@@ -412,10 +412,8 @@ static inline void receive_chars(struct uart_port *port, uint8_t *status,
412 412
413 if (uart_handle_sysrq_char(port, ch, regs)) 413 if (uart_handle_sysrq_char(port, ch, regs))
414 goto ignore_char; 414 goto ignore_char;
415 if ((lsr & port->ignore_status_mask) == 0) 415
416 tty_insert_flip_char(tty, ch, flag); 416 uart_insert_char(port, lsr, UART_LSR_OE, ch, flag);
417 if ((lsr & UART_LSR_OE) && (tty->flip.count < TTY_FLIPBUF_SIZE))
418 tty_insert_flip_char(tty, 0, TTY_OVERRUN);
419 417
420 ignore_char: 418 ignore_char:
421 lsr = siu_read(port, UART_LSR); 419 lsr = siu_read(port, UART_LSR);