aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Cox <alan@redhat.com>2008-07-16 16:55:37 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-20 20:12:36 -0400
commitd99101fda034922d5ecaa735910e9930f076325f (patch)
tree9a1b374037ceb6f26259980ba5ae8746e0f4bbe2
parent85f8f81052eeb3eac1242731a8777caacfef0aa9 (diff)
riscom8: remove bogus checks
Chris Malley posted a patch removing a NULL check in the riscom8 driver. Further analysis shows that even more of the tests are irrelevant so we can delete lots of stuff Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/char/riscom8.c32
1 files changed, 8 insertions, 24 deletions
diff --git a/drivers/char/riscom8.c b/drivers/char/riscom8.c
index b0ba241361e4..3ca8957ba327 100644
--- a/drivers/char/riscom8.c
+++ b/drivers/char/riscom8.c
@@ -638,9 +638,6 @@ static void rc_change_speed(struct riscom_board *bp, struct riscom_port *port)
638 unsigned char cor1 = 0, cor3 = 0; 638 unsigned char cor1 = 0, cor3 = 0;
639 unsigned char mcor1 = 0, mcor2 = 0; 639 unsigned char mcor1 = 0, mcor2 = 0;
640 640
641 if (tty == NULL || tty->termios == NULL)
642 return;
643
644 port->IER = 0; 641 port->IER = 0;
645 port->COR2 = 0; 642 port->COR2 = 0;
646 port->MSVR = MSVR_RTS; 643 port->MSVR = MSVR_RTS;
@@ -794,8 +791,7 @@ static int rc_setup_port(struct riscom_board *bp, struct riscom_port *port)
794 791
795 spin_lock_irqsave(&riscom_lock, flags); 792 spin_lock_irqsave(&riscom_lock, flags);
796 793
797 if (port->port.tty) 794 clear_bit(TTY_IO_ERROR, &port->port.tty->flags);
798 clear_bit(TTY_IO_ERROR, &port->port.tty->flags);
799 if (port->port.count == 1) 795 if (port->port.count == 1)
800 bp->count++; 796 bp->count++;
801 port->xmit_cnt = port->xmit_head = port->xmit_tail = 0; 797 port->xmit_cnt = port->xmit_head = port->xmit_tail = 0;
@@ -807,10 +803,9 @@ static int rc_setup_port(struct riscom_board *bp, struct riscom_port *port)
807} 803}
808 804
809/* Must be called with interrupts disabled */ 805/* Must be called with interrupts disabled */
810static void rc_shutdown_port(struct riscom_board *bp, struct riscom_port *port) 806static void rc_shutdown_port(struct tty_struct *tty,
807 struct riscom_board *bp, struct riscom_port *port)
811{ 808{
812 struct tty_struct *tty;
813
814 if (!(port->port.flags & ASYNC_INITIALIZED)) 809 if (!(port->port.flags & ASYNC_INITIALIZED))
815 return; 810 return;
816 811
@@ -830,10 +825,7 @@ static void rc_shutdown_port(struct riscom_board *bp, struct riscom_port *port)
830 } 825 }
831#endif 826#endif
832 tty_port_free_xmit_buf(&port->port); 827 tty_port_free_xmit_buf(&port->port);
833 828 if (C_HUPCL(tty)) {
834 tty = port->port.tty;
835
836 if (tty == NULL || C_HUPCL(tty)) {
837 /* Drop DTR */ 829 /* Drop DTR */
838 bp->DTR |= (1u << port_No(port)); 830 bp->DTR |= (1u << port_No(port));
839 rc_out(bp, RC_DTR, bp->DTR); 831 rc_out(bp, RC_DTR, bp->DTR);
@@ -848,8 +840,7 @@ static void rc_shutdown_port(struct riscom_board *bp, struct riscom_port *port)
848 port->IER = 0; 840 port->IER = 0;
849 rc_out(bp, CD180_IER, port->IER); 841 rc_out(bp, CD180_IER, port->IER);
850 842
851 if (tty) 843 set_bit(TTY_IO_ERROR, &tty->flags);
852 set_bit(TTY_IO_ERROR, &tty->flags);
853 port->port.flags &= ~ASYNC_INITIALIZED; 844 port->port.flags &= ~ASYNC_INITIALIZED;
854 845
855 if (--bp->count < 0) { 846 if (--bp->count < 0) {
@@ -1067,7 +1058,7 @@ static void rc_close(struct tty_struct *tty, struct file *filp)
1067 break; 1058 break;
1068 } 1059 }
1069 } 1060 }
1070 rc_shutdown_port(bp, port); 1061 rc_shutdown_port(tty, bp, port);
1071 rc_flush_buffer(tty); 1062 rc_flush_buffer(tty);
1072 tty_ldisc_flush(tty); 1063 tty_ldisc_flush(tty);
1073 1064
@@ -1098,9 +1089,6 @@ static int rc_write(struct tty_struct *tty,
1098 1089
1099 bp = port_Board(port); 1090 bp = port_Board(port);
1100 1091
1101 if (!tty || !port->port.xmit_buf)
1102 return 0;
1103
1104 while (1) { 1092 while (1) {
1105 spin_lock_irqsave(&riscom_lock, flags); 1093 spin_lock_irqsave(&riscom_lock, flags);
1106 1094
@@ -1141,9 +1129,6 @@ static int rc_put_char(struct tty_struct *tty, unsigned char ch)
1141 if (rc_paranoia_check(port, tty->name, "rc_put_char")) 1129 if (rc_paranoia_check(port, tty->name, "rc_put_char"))
1142 return 0; 1130 return 0;
1143 1131
1144 if (!tty || !port->port.xmit_buf)
1145 return 0;
1146
1147 spin_lock_irqsave(&riscom_lock, flags); 1132 spin_lock_irqsave(&riscom_lock, flags);
1148 1133
1149 if (port->xmit_cnt >= SERIAL_XMIT_SIZE - 1) 1134 if (port->xmit_cnt >= SERIAL_XMIT_SIZE - 1)
@@ -1167,8 +1152,7 @@ static void rc_flush_chars(struct tty_struct *tty)
1167 if (rc_paranoia_check(port, tty->name, "rc_flush_chars")) 1152 if (rc_paranoia_check(port, tty->name, "rc_flush_chars"))
1168 return; 1153 return;
1169 1154
1170 if (port->xmit_cnt <= 0 || tty->stopped || tty->hw_stopped || 1155 if (port->xmit_cnt <= 0 || tty->stopped || tty->hw_stopped)
1171 !port->port.xmit_buf)
1172 return; 1156 return;
1173 1157
1174 spin_lock_irqsave(&riscom_lock, flags); 1158 spin_lock_irqsave(&riscom_lock, flags);
@@ -1488,7 +1472,7 @@ static void rc_hangup(struct tty_struct *tty)
1488 1472
1489 bp = port_Board(port); 1473 bp = port_Board(port);
1490 1474
1491 rc_shutdown_port(bp, port); 1475 rc_shutdown_port(tty, bp, port);
1492 port->port.count = 0; 1476 port->port.count = 0;
1493 port->port.flags &= ~ASYNC_NORMAL_ACTIVE; 1477 port->port.flags &= ~ASYNC_NORMAL_ACTIVE;
1494 port->port.tty = NULL; 1478 port->port.tty = NULL;