aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial/serial_core.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/tty/serial/serial_core.c')
-rw-r--r--drivers/tty/serial/serial_core.c44
1 files changed, 24 insertions, 20 deletions
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 2cf5649a6dc0..b68550d95a40 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -89,8 +89,7 @@ static void __uart_start(struct tty_struct *tty)
89 struct uart_state *state = tty->driver_data; 89 struct uart_state *state = tty->driver_data;
90 struct uart_port *port = state->uart_port; 90 struct uart_port *port = state->uart_port;
91 91
92 if (!uart_circ_empty(&state->xmit) && state->xmit.buf && 92 if (!tty->stopped && !tty->hw_stopped)
93 !tty->stopped && !tty->hw_stopped)
94 port->ops->start_tx(port); 93 port->ops->start_tx(port);
95} 94}
96 95
@@ -138,6 +137,11 @@ static int uart_port_startup(struct tty_struct *tty, struct uart_state *state,
138 return 1; 137 return 1;
139 138
140 /* 139 /*
140 * Make sure the device is in D0 state.
141 */
142 uart_change_pm(state, UART_PM_STATE_ON);
143
144 /*
141 * Initialise and allocate the transmit and temporary 145 * Initialise and allocate the transmit and temporary
142 * buffer. 146 * buffer.
143 */ 147 */
@@ -826,25 +830,29 @@ static int uart_set_info(struct tty_struct *tty, struct tty_port *port,
826 * If we fail to request resources for the 830 * If we fail to request resources for the
827 * new port, try to restore the old settings. 831 * new port, try to restore the old settings.
828 */ 832 */
829 if (retval && old_type != PORT_UNKNOWN) { 833 if (retval) {
830 uport->iobase = old_iobase; 834 uport->iobase = old_iobase;
831 uport->type = old_type; 835 uport->type = old_type;
832 uport->hub6 = old_hub6; 836 uport->hub6 = old_hub6;
833 uport->iotype = old_iotype; 837 uport->iotype = old_iotype;
834 uport->regshift = old_shift; 838 uport->regshift = old_shift;
835 uport->mapbase = old_mapbase; 839 uport->mapbase = old_mapbase;
836 retval = uport->ops->request_port(uport);
837 /*
838 * If we failed to restore the old settings,
839 * we fail like this.
840 */
841 if (retval)
842 uport->type = PORT_UNKNOWN;
843 840
844 /* 841 if (old_type != PORT_UNKNOWN) {
845 * We failed anyway. 842 retval = uport->ops->request_port(uport);
846 */ 843 /*
847 retval = -EBUSY; 844 * If we failed to restore the old settings,
845 * we fail like this.
846 */
847 if (retval)
848 uport->type = PORT_UNKNOWN;
849
850 /*
851 * We failed anyway.
852 */
853 retval = -EBUSY;
854 }
855
848 /* Added to return the correct error -Ram Gupta */ 856 /* Added to return the correct error -Ram Gupta */
849 goto exit; 857 goto exit;
850 } 858 }
@@ -1452,6 +1460,8 @@ static void uart_hangup(struct tty_struct *tty)
1452 clear_bit(ASYNCB_NORMAL_ACTIVE, &port->flags); 1460 clear_bit(ASYNCB_NORMAL_ACTIVE, &port->flags);
1453 spin_unlock_irqrestore(&port->lock, flags); 1461 spin_unlock_irqrestore(&port->lock, flags);
1454 tty_port_tty_set(port, NULL); 1462 tty_port_tty_set(port, NULL);
1463 if (!uart_console(state->uart_port))
1464 uart_change_pm(state, UART_PM_STATE_OFF);
1455 wake_up_interruptible(&port->open_wait); 1465 wake_up_interruptible(&port->open_wait);
1456 wake_up_interruptible(&port->delta_msr_wait); 1466 wake_up_interruptible(&port->delta_msr_wait);
1457 } 1467 }
@@ -1570,12 +1580,6 @@ static int uart_open(struct tty_struct *tty, struct file *filp)
1570 } 1580 }
1571 1581
1572 /* 1582 /*
1573 * Make sure the device is in D0 state.
1574 */
1575 if (port->count == 1)
1576 uart_change_pm(state, UART_PM_STATE_ON);
1577
1578 /*
1579 * Start up the serial port. 1583 * Start up the serial port.
1580 */ 1584 */
1581 retval = uart_startup(tty, state, 0); 1585 retval = uart_startup(tty, state, 0);