aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial/mrst_max3110.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/tty/serial/mrst_max3110.c')
-rw-r--r--drivers/tty/serial/mrst_max3110.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/drivers/tty/serial/mrst_max3110.c b/drivers/tty/serial/mrst_max3110.c
index 58734d7e746d..f641c232beca 100644
--- a/drivers/tty/serial/mrst_max3110.c
+++ b/drivers/tty/serial/mrst_max3110.c
@@ -339,7 +339,7 @@ static int
339receive_chars(struct uart_max3110 *max, unsigned short *str, int len) 339receive_chars(struct uart_max3110 *max, unsigned short *str, int len)
340{ 340{
341 struct uart_port *port = &max->port; 341 struct uart_port *port = &max->port;
342 struct tty_struct *tty; 342 struct tty_port *tport;
343 char buf[M3110_RX_FIFO_DEPTH]; 343 char buf[M3110_RX_FIFO_DEPTH];
344 int r, w, usable; 344 int r, w, usable;
345 345
@@ -347,9 +347,7 @@ receive_chars(struct uart_max3110 *max, unsigned short *str, int len)
347 if (!port->state) 347 if (!port->state)
348 return 0; 348 return 0;
349 349
350 tty = tty_port_tty_get(&port->state->port); 350 tport = &port->state->port;
351 if (!tty)
352 return 0;
353 351
354 for (r = 0, w = 0; r < len; r++) { 352 for (r = 0, w = 0; r < len; r++) {
355 if (str[r] & MAX3110_BREAK && 353 if (str[r] & MAX3110_BREAK &&
@@ -364,20 +362,17 @@ receive_chars(struct uart_max3110 *max, unsigned short *str, int len)
364 } 362 }
365 } 363 }
366 364
367 if (!w) { 365 if (!w)
368 tty_kref_put(tty);
369 return 0; 366 return 0;
370 }
371 367
372 for (r = 0; w; r += usable, w -= usable) { 368 for (r = 0; w; r += usable, w -= usable) {
373 usable = tty_buffer_request_room(tty, w); 369 usable = tty_buffer_request_room(tport, w);
374 if (usable) { 370 if (usable) {
375 tty_insert_flip_string(tty, buf + r, usable); 371 tty_insert_flip_string(tport, buf + r, usable);
376 port->icount.rx += usable; 372 port->icount.rx += usable;
377 } 373 }
378 } 374 }
379 tty_flip_buffer_push(tty); 375 tty_flip_buffer_push(tport);
380 tty_kref_put(tty);
381 376
382 return r; 377 return r;
383} 378}
@@ -493,7 +488,7 @@ static int serial_m3110_startup(struct uart_port *port)
493 | WC_BAUD_DR2; 488 | WC_BAUD_DR2;
494 489
495 /* as we use thread to handle tx/rx, need set low latency */ 490 /* as we use thread to handle tx/rx, need set low latency */
496 port->state->port.tty->low_latency = 1; 491 port->state->port.low_latency = 1;
497 492
498 if (max->irq) { 493 if (max->irq) {
499 max->read_thread = NULL; 494 max->read_thread = NULL;