diff options
Diffstat (limited to 'drivers/tty/serial/serial_core.c')
-rw-r--r-- | drivers/tty/serial/serial_core.c | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index f26834d262b3..b68550d95a40 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c | |||
@@ -137,6 +137,11 @@ static int uart_port_startup(struct tty_struct *tty, struct uart_state *state, | |||
137 | return 1; | 137 | return 1; |
138 | 138 | ||
139 | /* | 139 | /* |
140 | * Make sure the device is in D0 state. | ||
141 | */ | ||
142 | uart_change_pm(state, UART_PM_STATE_ON); | ||
143 | |||
144 | /* | ||
140 | * Initialise and allocate the transmit and temporary | 145 | * Initialise and allocate the transmit and temporary |
141 | * buffer. | 146 | * buffer. |
142 | */ | 147 | */ |
@@ -825,25 +830,29 @@ static int uart_set_info(struct tty_struct *tty, struct tty_port *port, | |||
825 | * If we fail to request resources for the | 830 | * If we fail to request resources for the |
826 | * new port, try to restore the old settings. | 831 | * new port, try to restore the old settings. |
827 | */ | 832 | */ |
828 | if (retval && old_type != PORT_UNKNOWN) { | 833 | if (retval) { |
829 | uport->iobase = old_iobase; | 834 | uport->iobase = old_iobase; |
830 | uport->type = old_type; | 835 | uport->type = old_type; |
831 | uport->hub6 = old_hub6; | 836 | uport->hub6 = old_hub6; |
832 | uport->iotype = old_iotype; | 837 | uport->iotype = old_iotype; |
833 | uport->regshift = old_shift; | 838 | uport->regshift = old_shift; |
834 | uport->mapbase = old_mapbase; | 839 | uport->mapbase = old_mapbase; |
835 | retval = uport->ops->request_port(uport); | ||
836 | /* | ||
837 | * If we failed to restore the old settings, | ||
838 | * we fail like this. | ||
839 | */ | ||
840 | if (retval) | ||
841 | uport->type = PORT_UNKNOWN; | ||
842 | 840 | ||
843 | /* | 841 | if (old_type != PORT_UNKNOWN) { |
844 | * We failed anyway. | 842 | retval = uport->ops->request_port(uport); |
845 | */ | 843 | /* |
846 | 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 | |||
847 | /* Added to return the correct error -Ram Gupta */ | 856 | /* Added to return the correct error -Ram Gupta */ |
848 | goto exit; | 857 | goto exit; |
849 | } | 858 | } |
@@ -1571,12 +1580,6 @@ static int uart_open(struct tty_struct *tty, struct file *filp) | |||
1571 | } | 1580 | } |
1572 | 1581 | ||
1573 | /* | 1582 | /* |
1574 | * Make sure the device is in D0 state. | ||
1575 | */ | ||
1576 | if (port->count == 1) | ||
1577 | uart_change_pm(state, UART_PM_STATE_ON); | ||
1578 | |||
1579 | /* | ||
1580 | * Start up the serial port. | 1583 | * Start up the serial port. |
1581 | */ | 1584 | */ |
1582 | retval = uart_startup(tty, state, 0); | 1585 | retval = uart_startup(tty, state, 0); |