diff options
Diffstat (limited to 'drivers/tty/serial/pmac_zilog.c')
| -rw-r--r-- | drivers/tty/serial/pmac_zilog.c | 30 | 
1 files changed, 14 insertions, 16 deletions
diff --git a/drivers/tty/serial/pmac_zilog.c b/drivers/tty/serial/pmac_zilog.c index 73a3f295e7c..b1785f58b6e 100644 --- a/drivers/tty/serial/pmac_zilog.c +++ b/drivers/tty/serial/pmac_zilog.c @@ -227,21 +227,19 @@ static void pmz_interrupt_control(struct uart_pmac_port *uap, int enable)  	write_zsreg(uap, R1, uap->curregs[1]);  } -static struct tty_struct *pmz_receive_chars(struct uart_pmac_port *uap) +static bool pmz_receive_chars(struct uart_pmac_port *uap)  {  	struct tty_port *port; -	struct tty_struct *tty = NULL;  	unsigned char ch, r1, drop, error, flag;  	int loops = 0;  	/* Sanity check, make sure the old bug is no longer happening */ -	if (uap->port.state == NULL || uap->port.state->port.tty == NULL) { +	if (uap->port.state == NULL) {  		WARN_ON(1);  		(void)read_zsdata(uap); -		return NULL; +		return false;  	}  	port = &uap->port.state->port; -	tty = port->tty; /* TOCTOU above */  	while (1) {  		error = 0; @@ -330,11 +328,11 @@ static struct tty_struct *pmz_receive_chars(struct uart_pmac_port *uap)  			break;  	} -	return tty; +	return true;   flood:  	pmz_interrupt_control(uap, 0);  	pmz_error("pmz: rx irq flood !\n"); -	return tty; +	return true;  }  static void pmz_status_handle(struct uart_pmac_port *uap) @@ -455,7 +453,7 @@ static irqreturn_t pmz_interrupt(int irq, void *dev_id)  	struct uart_pmac_port *uap_a;  	struct uart_pmac_port *uap_b;  	int rc = IRQ_NONE; -	struct tty_struct *tty; +	bool push;  	u8 r3;  	uap_a = pmz_get_port_A(uap); @@ -468,7 +466,7 @@ static irqreturn_t pmz_interrupt(int irq, void *dev_id)  	pmz_debug("irq, r3: %x\n", r3);  #endif  	/* Channel A */ -	tty = NULL; +	push = false;  	if (r3 & (CHAEXT | CHATxIP | CHARxIP)) {  		if (!ZS_IS_OPEN(uap_a)) {  			pmz_debug("ChanA interrupt while not open !\n"); @@ -479,21 +477,21 @@ static irqreturn_t pmz_interrupt(int irq, void *dev_id)  		if (r3 & CHAEXT)  			pmz_status_handle(uap_a);  		if (r3 & CHARxIP) -			tty = pmz_receive_chars(uap_a); +			push = pmz_receive_chars(uap_a);  		if (r3 & CHATxIP)  			pmz_transmit_chars(uap_a);  		rc = IRQ_HANDLED;  	}   skip_a:  	spin_unlock(&uap_a->port.lock); -	if (tty != NULL) -		tty_flip_buffer_push(tty); +	if (push) +		tty_flip_buffer_push(&uap->port.state->port);  	if (!uap_b)  		goto out;  	spin_lock(&uap_b->port.lock); -	tty = NULL; +	push = false;  	if (r3 & (CHBEXT | CHBTxIP | CHBRxIP)) {  		if (!ZS_IS_OPEN(uap_b)) {  			pmz_debug("ChanB interrupt while not open !\n"); @@ -504,15 +502,15 @@ static irqreturn_t pmz_interrupt(int irq, void *dev_id)  		if (r3 & CHBEXT)  			pmz_status_handle(uap_b);  		if (r3 & CHBRxIP) -			tty = pmz_receive_chars(uap_b); +			push = pmz_receive_chars(uap_b);  		if (r3 & CHBTxIP)  			pmz_transmit_chars(uap_b);  		rc = IRQ_HANDLED;  	}   skip_b:  	spin_unlock(&uap_b->port.lock); -	if (tty != NULL) -		tty_flip_buffer_push(tty); +	if (push) +		tty_flip_buffer_push(&uap->port.state->port);   out:  	return rc;  |