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.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 460a72d91bb7..733fe8e73f0f 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -905,7 +905,7 @@ static int uart_get_lsr_info(struct tty_struct *tty,
905 return put_user(result, value); 905 return put_user(result, value);
906} 906}
907 907
908static int uart_tiocmget(struct tty_struct *tty, struct file *file) 908static int uart_tiocmget(struct tty_struct *tty)
909{ 909{
910 struct uart_state *state = tty->driver_data; 910 struct uart_state *state = tty->driver_data;
911 struct tty_port *port = &state->port; 911 struct tty_port *port = &state->port;
@@ -913,10 +913,8 @@ static int uart_tiocmget(struct tty_struct *tty, struct file *file)
913 int result = -EIO; 913 int result = -EIO;
914 914
915 mutex_lock(&port->mutex); 915 mutex_lock(&port->mutex);
916 if ((!file || !tty_hung_up_p(file)) && 916 if (!(tty->flags & (1 << TTY_IO_ERROR))) {
917 !(tty->flags & (1 << TTY_IO_ERROR))) {
918 result = uport->mctrl; 917 result = uport->mctrl;
919
920 spin_lock_irq(&uport->lock); 918 spin_lock_irq(&uport->lock);
921 result |= uport->ops->get_mctrl(uport); 919 result |= uport->ops->get_mctrl(uport);
922 spin_unlock_irq(&uport->lock); 920 spin_unlock_irq(&uport->lock);
@@ -927,8 +925,7 @@ static int uart_tiocmget(struct tty_struct *tty, struct file *file)
927} 925}
928 926
929static int 927static int
930uart_tiocmset(struct tty_struct *tty, struct file *file, 928uart_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear)
931 unsigned int set, unsigned int clear)
932{ 929{
933 struct uart_state *state = tty->driver_data; 930 struct uart_state *state = tty->driver_data;
934 struct uart_port *uport = state->uart_port; 931 struct uart_port *uport = state->uart_port;
@@ -936,8 +933,7 @@ uart_tiocmset(struct tty_struct *tty, struct file *file,
936 int ret = -EIO; 933 int ret = -EIO;
937 934
938 mutex_lock(&port->mutex); 935 mutex_lock(&port->mutex);
939 if ((!file || !tty_hung_up_p(file)) && 936 if (!(tty->flags & (1 << TTY_IO_ERROR))) {
940 !(tty->flags & (1 << TTY_IO_ERROR))) {
941 uart_update_mctrl(uport, set, clear); 937 uart_update_mctrl(uport, set, clear);
942 ret = 0; 938 ret = 0;
943 } 939 }
@@ -1103,7 +1099,7 @@ static int uart_get_icount(struct tty_struct *tty,
1103 * Called via sys_ioctl. We can use spin_lock_irq() here. 1099 * Called via sys_ioctl. We can use spin_lock_irq() here.
1104 */ 1100 */
1105static int 1101static int
1106uart_ioctl(struct tty_struct *tty, struct file *filp, unsigned int cmd, 1102uart_ioctl(struct tty_struct *tty, unsigned int cmd,
1107 unsigned long arg) 1103 unsigned long arg)
1108{ 1104{
1109 struct uart_state *state = tty->driver_data; 1105 struct uart_state *state = tty->driver_data;
@@ -1156,7 +1152,7 @@ uart_ioctl(struct tty_struct *tty, struct file *filp, unsigned int cmd,
1156 1152
1157 mutex_lock(&port->mutex); 1153 mutex_lock(&port->mutex);
1158 1154
1159 if (tty_hung_up_p(filp)) { 1155 if (tty->flags & (1 << TTY_IO_ERROR)) {
1160 ret = -EIO; 1156 ret = -EIO;
1161 goto out_up; 1157 goto out_up;
1162 } 1158 }
@@ -2064,7 +2060,7 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *uport)
2064 /* 2060 /*
2065 * Re-enable the console device after suspending. 2061 * Re-enable the console device after suspending.
2066 */ 2062 */
2067 if (console_suspend_enabled && uart_console(uport)) { 2063 if (uart_console(uport)) {
2068 /* 2064 /*
2069 * First try to use the console cflag setting. 2065 * First try to use the console cflag setting.
2070 */ 2066 */
@@ -2077,9 +2073,9 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *uport)
2077 if (port->tty && port->tty->termios && termios.c_cflag == 0) 2073 if (port->tty && port->tty->termios && termios.c_cflag == 0)
2078 termios = *(port->tty->termios); 2074 termios = *(port->tty->termios);
2079 2075
2080 uart_change_pm(state, 0);
2081 uport->ops->set_termios(uport, &termios, NULL); 2076 uport->ops->set_termios(uport, &termios, NULL);
2082 console_start(uport->cons); 2077 if (console_suspend_enabled)
2078 console_start(uport->cons);
2083 } 2079 }
2084 2080
2085 if (port->flags & ASYNC_SUSPENDED) { 2081 if (port->flags & ASYNC_SUSPENDED) {