diff options
Diffstat (limited to 'drivers/tty/serial/sh-sci.c')
-rw-r--r-- | drivers/tty/serial/sh-sci.c | 52 |
1 files changed, 25 insertions, 27 deletions
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index 61477567423f..156418619949 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c | |||
@@ -596,7 +596,7 @@ static void sci_transmit_chars(struct uart_port *port) | |||
596 | static void sci_receive_chars(struct uart_port *port) | 596 | static void sci_receive_chars(struct uart_port *port) |
597 | { | 597 | { |
598 | struct sci_port *sci_port = to_sci_port(port); | 598 | struct sci_port *sci_port = to_sci_port(port); |
599 | struct tty_struct *tty = port->state->port.tty; | 599 | struct tty_port *tport = &port->state->port; |
600 | int i, count, copied = 0; | 600 | int i, count, copied = 0; |
601 | unsigned short status; | 601 | unsigned short status; |
602 | unsigned char flag; | 602 | unsigned char flag; |
@@ -607,7 +607,7 @@ static void sci_receive_chars(struct uart_port *port) | |||
607 | 607 | ||
608 | while (1) { | 608 | while (1) { |
609 | /* Don't copy more bytes than there is room for in the buffer */ | 609 | /* Don't copy more bytes than there is room for in the buffer */ |
610 | count = tty_buffer_request_room(tty, sci_rxfill(port)); | 610 | count = tty_buffer_request_room(tport, sci_rxfill(port)); |
611 | 611 | ||
612 | /* If for any reason we can't copy more data, we're done! */ | 612 | /* If for any reason we can't copy more data, we're done! */ |
613 | if (count == 0) | 613 | if (count == 0) |
@@ -619,7 +619,7 @@ static void sci_receive_chars(struct uart_port *port) | |||
619 | sci_port->break_flag) | 619 | sci_port->break_flag) |
620 | count = 0; | 620 | count = 0; |
621 | else | 621 | else |
622 | tty_insert_flip_char(tty, c, TTY_NORMAL); | 622 | tty_insert_flip_char(tport, c, TTY_NORMAL); |
623 | } else { | 623 | } else { |
624 | for (i = 0; i < count; i++) { | 624 | for (i = 0; i < count; i++) { |
625 | char c = serial_port_in(port, SCxRDR); | 625 | char c = serial_port_in(port, SCxRDR); |
@@ -661,7 +661,7 @@ static void sci_receive_chars(struct uart_port *port) | |||
661 | } else | 661 | } else |
662 | flag = TTY_NORMAL; | 662 | flag = TTY_NORMAL; |
663 | 663 | ||
664 | tty_insert_flip_char(tty, c, flag); | 664 | tty_insert_flip_char(tport, c, flag); |
665 | } | 665 | } |
666 | } | 666 | } |
667 | 667 | ||
@@ -674,7 +674,7 @@ static void sci_receive_chars(struct uart_port *port) | |||
674 | 674 | ||
675 | if (copied) { | 675 | if (copied) { |
676 | /* Tell the rest of the system the news. New characters! */ | 676 | /* Tell the rest of the system the news. New characters! */ |
677 | tty_flip_buffer_push(tty); | 677 | tty_flip_buffer_push(tport); |
678 | } else { | 678 | } else { |
679 | serial_port_in(port, SCxSR); /* dummy read */ | 679 | serial_port_in(port, SCxSR); /* dummy read */ |
680 | serial_port_out(port, SCxSR, SCxSR_RDxF_CLEAR(port)); | 680 | serial_port_out(port, SCxSR, SCxSR_RDxF_CLEAR(port)); |
@@ -720,7 +720,7 @@ static int sci_handle_errors(struct uart_port *port) | |||
720 | { | 720 | { |
721 | int copied = 0; | 721 | int copied = 0; |
722 | unsigned short status = serial_port_in(port, SCxSR); | 722 | unsigned short status = serial_port_in(port, SCxSR); |
723 | struct tty_struct *tty = port->state->port.tty; | 723 | struct tty_port *tport = &port->state->port; |
724 | struct sci_port *s = to_sci_port(port); | 724 | struct sci_port *s = to_sci_port(port); |
725 | 725 | ||
726 | /* | 726 | /* |
@@ -731,7 +731,7 @@ static int sci_handle_errors(struct uart_port *port) | |||
731 | port->icount.overrun++; | 731 | port->icount.overrun++; |
732 | 732 | ||
733 | /* overrun error */ | 733 | /* overrun error */ |
734 | if (tty_insert_flip_char(tty, 0, TTY_OVERRUN)) | 734 | if (tty_insert_flip_char(tport, 0, TTY_OVERRUN)) |
735 | copied++; | 735 | copied++; |
736 | 736 | ||
737 | dev_notice(port->dev, "overrun error"); | 737 | dev_notice(port->dev, "overrun error"); |
@@ -755,7 +755,7 @@ static int sci_handle_errors(struct uart_port *port) | |||
755 | 755 | ||
756 | dev_dbg(port->dev, "BREAK detected\n"); | 756 | dev_dbg(port->dev, "BREAK detected\n"); |
757 | 757 | ||
758 | if (tty_insert_flip_char(tty, 0, TTY_BREAK)) | 758 | if (tty_insert_flip_char(tport, 0, TTY_BREAK)) |
759 | copied++; | 759 | copied++; |
760 | } | 760 | } |
761 | 761 | ||
@@ -763,7 +763,7 @@ static int sci_handle_errors(struct uart_port *port) | |||
763 | /* frame error */ | 763 | /* frame error */ |
764 | port->icount.frame++; | 764 | port->icount.frame++; |
765 | 765 | ||
766 | if (tty_insert_flip_char(tty, 0, TTY_FRAME)) | 766 | if (tty_insert_flip_char(tport, 0, TTY_FRAME)) |
767 | copied++; | 767 | copied++; |
768 | 768 | ||
769 | dev_notice(port->dev, "frame error\n"); | 769 | dev_notice(port->dev, "frame error\n"); |
@@ -774,21 +774,21 @@ static int sci_handle_errors(struct uart_port *port) | |||
774 | /* parity error */ | 774 | /* parity error */ |
775 | port->icount.parity++; | 775 | port->icount.parity++; |
776 | 776 | ||
777 | if (tty_insert_flip_char(tty, 0, TTY_PARITY)) | 777 | if (tty_insert_flip_char(tport, 0, TTY_PARITY)) |
778 | copied++; | 778 | copied++; |
779 | 779 | ||
780 | dev_notice(port->dev, "parity error"); | 780 | dev_notice(port->dev, "parity error"); |
781 | } | 781 | } |
782 | 782 | ||
783 | if (copied) | 783 | if (copied) |
784 | tty_flip_buffer_push(tty); | 784 | tty_flip_buffer_push(tport); |
785 | 785 | ||
786 | return copied; | 786 | return copied; |
787 | } | 787 | } |
788 | 788 | ||
789 | static int sci_handle_fifo_overrun(struct uart_port *port) | 789 | static int sci_handle_fifo_overrun(struct uart_port *port) |
790 | { | 790 | { |
791 | struct tty_struct *tty = port->state->port.tty; | 791 | struct tty_port *tport = &port->state->port; |
792 | struct sci_port *s = to_sci_port(port); | 792 | struct sci_port *s = to_sci_port(port); |
793 | struct plat_sci_reg *reg; | 793 | struct plat_sci_reg *reg; |
794 | int copied = 0; | 794 | int copied = 0; |
@@ -802,8 +802,8 @@ static int sci_handle_fifo_overrun(struct uart_port *port) | |||
802 | 802 | ||
803 | port->icount.overrun++; | 803 | port->icount.overrun++; |
804 | 804 | ||
805 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); | 805 | tty_insert_flip_char(tport, 0, TTY_OVERRUN); |
806 | tty_flip_buffer_push(tty); | 806 | tty_flip_buffer_push(tport); |
807 | 807 | ||
808 | dev_notice(port->dev, "overrun error\n"); | 808 | dev_notice(port->dev, "overrun error\n"); |
809 | copied++; | 809 | copied++; |
@@ -816,7 +816,7 @@ static int sci_handle_breaks(struct uart_port *port) | |||
816 | { | 816 | { |
817 | int copied = 0; | 817 | int copied = 0; |
818 | unsigned short status = serial_port_in(port, SCxSR); | 818 | unsigned short status = serial_port_in(port, SCxSR); |
819 | struct tty_struct *tty = port->state->port.tty; | 819 | struct tty_port *tport = &port->state->port; |
820 | struct sci_port *s = to_sci_port(port); | 820 | struct sci_port *s = to_sci_port(port); |
821 | 821 | ||
822 | if (uart_handle_break(port)) | 822 | if (uart_handle_break(port)) |
@@ -831,14 +831,14 @@ static int sci_handle_breaks(struct uart_port *port) | |||
831 | port->icount.brk++; | 831 | port->icount.brk++; |
832 | 832 | ||
833 | /* Notify of BREAK */ | 833 | /* Notify of BREAK */ |
834 | if (tty_insert_flip_char(tty, 0, TTY_BREAK)) | 834 | if (tty_insert_flip_char(tport, 0, TTY_BREAK)) |
835 | copied++; | 835 | copied++; |
836 | 836 | ||
837 | dev_dbg(port->dev, "BREAK detected\n"); | 837 | dev_dbg(port->dev, "BREAK detected\n"); |
838 | } | 838 | } |
839 | 839 | ||
840 | if (copied) | 840 | if (copied) |
841 | tty_flip_buffer_push(tty); | 841 | tty_flip_buffer_push(tport); |
842 | 842 | ||
843 | copied += sci_handle_fifo_overrun(port); | 843 | copied += sci_handle_fifo_overrun(port); |
844 | 844 | ||
@@ -1259,13 +1259,13 @@ static void sci_dma_tx_complete(void *arg) | |||
1259 | } | 1259 | } |
1260 | 1260 | ||
1261 | /* Locking: called with port lock held */ | 1261 | /* Locking: called with port lock held */ |
1262 | static int sci_dma_rx_push(struct sci_port *s, struct tty_struct *tty, | 1262 | static int sci_dma_rx_push(struct sci_port *s, size_t count) |
1263 | size_t count) | ||
1264 | { | 1263 | { |
1265 | struct uart_port *port = &s->port; | 1264 | struct uart_port *port = &s->port; |
1265 | struct tty_port *tport = &port->state->port; | ||
1266 | int i, active, room; | 1266 | int i, active, room; |
1267 | 1267 | ||
1268 | room = tty_buffer_request_room(tty, count); | 1268 | room = tty_buffer_request_room(tport, count); |
1269 | 1269 | ||
1270 | if (s->active_rx == s->cookie_rx[0]) { | 1270 | if (s->active_rx == s->cookie_rx[0]) { |
1271 | active = 0; | 1271 | active = 0; |
@@ -1283,7 +1283,7 @@ static int sci_dma_rx_push(struct sci_port *s, struct tty_struct *tty, | |||
1283 | return room; | 1283 | return room; |
1284 | 1284 | ||
1285 | for (i = 0; i < room; i++) | 1285 | for (i = 0; i < room; i++) |
1286 | tty_insert_flip_char(tty, ((u8 *)sg_virt(&s->sg_rx[active]))[i], | 1286 | tty_insert_flip_char(tport, ((u8 *)sg_virt(&s->sg_rx[active]))[i], |
1287 | TTY_NORMAL); | 1287 | TTY_NORMAL); |
1288 | 1288 | ||
1289 | port->icount.rx += room; | 1289 | port->icount.rx += room; |
@@ -1295,7 +1295,6 @@ static void sci_dma_rx_complete(void *arg) | |||
1295 | { | 1295 | { |
1296 | struct sci_port *s = arg; | 1296 | struct sci_port *s = arg; |
1297 | struct uart_port *port = &s->port; | 1297 | struct uart_port *port = &s->port; |
1298 | struct tty_struct *tty = port->state->port.tty; | ||
1299 | unsigned long flags; | 1298 | unsigned long flags; |
1300 | int count; | 1299 | int count; |
1301 | 1300 | ||
@@ -1303,14 +1302,14 @@ static void sci_dma_rx_complete(void *arg) | |||
1303 | 1302 | ||
1304 | spin_lock_irqsave(&port->lock, flags); | 1303 | spin_lock_irqsave(&port->lock, flags); |
1305 | 1304 | ||
1306 | count = sci_dma_rx_push(s, tty, s->buf_len_rx); | 1305 | count = sci_dma_rx_push(s, s->buf_len_rx); |
1307 | 1306 | ||
1308 | mod_timer(&s->rx_timer, jiffies + s->rx_timeout); | 1307 | mod_timer(&s->rx_timer, jiffies + s->rx_timeout); |
1309 | 1308 | ||
1310 | spin_unlock_irqrestore(&port->lock, flags); | 1309 | spin_unlock_irqrestore(&port->lock, flags); |
1311 | 1310 | ||
1312 | if (count) | 1311 | if (count) |
1313 | tty_flip_buffer_push(tty); | 1312 | tty_flip_buffer_push(&port->state->port); |
1314 | 1313 | ||
1315 | schedule_work(&s->work_rx); | 1314 | schedule_work(&s->work_rx); |
1316 | } | 1315 | } |
@@ -1404,7 +1403,6 @@ static void work_fn_rx(struct work_struct *work) | |||
1404 | if (dma_async_is_tx_complete(s->chan_rx, s->active_rx, NULL, NULL) != | 1403 | if (dma_async_is_tx_complete(s->chan_rx, s->active_rx, NULL, NULL) != |
1405 | DMA_SUCCESS) { | 1404 | DMA_SUCCESS) { |
1406 | /* Handle incomplete DMA receive */ | 1405 | /* Handle incomplete DMA receive */ |
1407 | struct tty_struct *tty = port->state->port.tty; | ||
1408 | struct dma_chan *chan = s->chan_rx; | 1406 | struct dma_chan *chan = s->chan_rx; |
1409 | struct shdma_desc *sh_desc = container_of(desc, | 1407 | struct shdma_desc *sh_desc = container_of(desc, |
1410 | struct shdma_desc, async_tx); | 1408 | struct shdma_desc, async_tx); |
@@ -1416,11 +1414,11 @@ static void work_fn_rx(struct work_struct *work) | |||
1416 | sh_desc->partial, sh_desc->cookie); | 1414 | sh_desc->partial, sh_desc->cookie); |
1417 | 1415 | ||
1418 | spin_lock_irqsave(&port->lock, flags); | 1416 | spin_lock_irqsave(&port->lock, flags); |
1419 | count = sci_dma_rx_push(s, tty, sh_desc->partial); | 1417 | count = sci_dma_rx_push(s, sh_desc->partial); |
1420 | spin_unlock_irqrestore(&port->lock, flags); | 1418 | spin_unlock_irqrestore(&port->lock, flags); |
1421 | 1419 | ||
1422 | if (count) | 1420 | if (count) |
1423 | tty_flip_buffer_push(tty); | 1421 | tty_flip_buffer_push(&port->state->port); |
1424 | 1422 | ||
1425 | sci_submit_rx(s); | 1423 | sci_submit_rx(s); |
1426 | 1424 | ||