Commit d99101fd authored by Alan Cox's avatar Alan Cox Committed by Linus Torvalds

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: default avatarAlan Cox <alan@redhat.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 85f8f810
...@@ -638,9 +638,6 @@ static void rc_change_speed(struct riscom_board *bp, struct riscom_port *port) ...@@ -638,9 +638,6 @@ static void rc_change_speed(struct riscom_board *bp, struct riscom_port *port)
unsigned char cor1 = 0, cor3 = 0; unsigned char cor1 = 0, cor3 = 0;
unsigned char mcor1 = 0, mcor2 = 0; unsigned char mcor1 = 0, mcor2 = 0;
if (tty == NULL || tty->termios == NULL)
return;
port->IER = 0; port->IER = 0;
port->COR2 = 0; port->COR2 = 0;
port->MSVR = MSVR_RTS; port->MSVR = MSVR_RTS;
...@@ -794,7 +791,6 @@ static int rc_setup_port(struct riscom_board *bp, struct riscom_port *port) ...@@ -794,7 +791,6 @@ static int rc_setup_port(struct riscom_board *bp, struct riscom_port *port)
spin_lock_irqsave(&riscom_lock, flags); spin_lock_irqsave(&riscom_lock, flags);
if (port->port.tty)
clear_bit(TTY_IO_ERROR, &port->port.tty->flags); clear_bit(TTY_IO_ERROR, &port->port.tty->flags);
if (port->port.count == 1) if (port->port.count == 1)
bp->count++; bp->count++;
...@@ -807,10 +803,9 @@ static int rc_setup_port(struct riscom_board *bp, struct riscom_port *port) ...@@ -807,10 +803,9 @@ static int rc_setup_port(struct riscom_board *bp, struct riscom_port *port)
} }
/* Must be called with interrupts disabled */ /* Must be called with interrupts disabled */
static void rc_shutdown_port(struct riscom_board *bp, struct riscom_port *port) static void rc_shutdown_port(struct tty_struct *tty,
struct riscom_board *bp, struct riscom_port *port)
{ {
struct tty_struct *tty;
if (!(port->port.flags & ASYNC_INITIALIZED)) if (!(port->port.flags & ASYNC_INITIALIZED))
return; return;
...@@ -830,10 +825,7 @@ static void rc_shutdown_port(struct riscom_board *bp, struct riscom_port *port) ...@@ -830,10 +825,7 @@ static void rc_shutdown_port(struct riscom_board *bp, struct riscom_port *port)
} }
#endif #endif
tty_port_free_xmit_buf(&port->port); tty_port_free_xmit_buf(&port->port);
if (C_HUPCL(tty)) {
tty = port->port.tty;
if (tty == NULL || C_HUPCL(tty)) {
/* Drop DTR */ /* Drop DTR */
bp->DTR |= (1u << port_No(port)); bp->DTR |= (1u << port_No(port));
rc_out(bp, RC_DTR, bp->DTR); rc_out(bp, RC_DTR, bp->DTR);
...@@ -848,7 +840,6 @@ static void rc_shutdown_port(struct riscom_board *bp, struct riscom_port *port) ...@@ -848,7 +840,6 @@ static void rc_shutdown_port(struct riscom_board *bp, struct riscom_port *port)
port->IER = 0; port->IER = 0;
rc_out(bp, CD180_IER, port->IER); rc_out(bp, CD180_IER, port->IER);
if (tty)
set_bit(TTY_IO_ERROR, &tty->flags); set_bit(TTY_IO_ERROR, &tty->flags);
port->port.flags &= ~ASYNC_INITIALIZED; port->port.flags &= ~ASYNC_INITIALIZED;
...@@ -1067,7 +1058,7 @@ static void rc_close(struct tty_struct *tty, struct file *filp) ...@@ -1067,7 +1058,7 @@ static void rc_close(struct tty_struct *tty, struct file *filp)
break; break;
} }
} }
rc_shutdown_port(bp, port); rc_shutdown_port(tty, bp, port);
rc_flush_buffer(tty); rc_flush_buffer(tty);
tty_ldisc_flush(tty); tty_ldisc_flush(tty);
...@@ -1098,9 +1089,6 @@ static int rc_write(struct tty_struct *tty, ...@@ -1098,9 +1089,6 @@ static int rc_write(struct tty_struct *tty,
bp = port_Board(port); bp = port_Board(port);
if (!tty || !port->port.xmit_buf)
return 0;
while (1) { while (1) {
spin_lock_irqsave(&riscom_lock, flags); spin_lock_irqsave(&riscom_lock, flags);
...@@ -1141,9 +1129,6 @@ static int rc_put_char(struct tty_struct *tty, unsigned char ch) ...@@ -1141,9 +1129,6 @@ static int rc_put_char(struct tty_struct *tty, unsigned char ch)
if (rc_paranoia_check(port, tty->name, "rc_put_char")) if (rc_paranoia_check(port, tty->name, "rc_put_char"))
return 0; return 0;
if (!tty || !port->port.xmit_buf)
return 0;
spin_lock_irqsave(&riscom_lock, flags); spin_lock_irqsave(&riscom_lock, flags);
if (port->xmit_cnt >= SERIAL_XMIT_SIZE - 1) if (port->xmit_cnt >= SERIAL_XMIT_SIZE - 1)
...@@ -1167,8 +1152,7 @@ static void rc_flush_chars(struct tty_struct *tty) ...@@ -1167,8 +1152,7 @@ static void rc_flush_chars(struct tty_struct *tty)
if (rc_paranoia_check(port, tty->name, "rc_flush_chars")) if (rc_paranoia_check(port, tty->name, "rc_flush_chars"))
return; return;
if (port->xmit_cnt <= 0 || tty->stopped || tty->hw_stopped || if (port->xmit_cnt <= 0 || tty->stopped || tty->hw_stopped)
!port->port.xmit_buf)
return; return;
spin_lock_irqsave(&riscom_lock, flags); spin_lock_irqsave(&riscom_lock, flags);
...@@ -1488,7 +1472,7 @@ static void rc_hangup(struct tty_struct *tty) ...@@ -1488,7 +1472,7 @@ static void rc_hangup(struct tty_struct *tty)
bp = port_Board(port); bp = port_Board(port);
rc_shutdown_port(bp, port); rc_shutdown_port(tty, bp, port);
port->port.count = 0; port->port.count = 0;
port->port.flags &= ~ASYNC_NORMAL_ACTIVE; port->port.flags &= ~ASYNC_NORMAL_ACTIVE;
port->port.tty = NULL; port->port.tty = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment