diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-05-20 23:57:27 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-05-20 23:57:27 -0400 |
commit | e10abc629f38efd9b6936cf3612583cc846104d9 (patch) | |
tree | 58fb8f6dba5d085d4b0352137d18faf7cfa47a69 /net/irda | |
parent | 0eff4589c36edd03d50b835d0768b2c2ef3f20bd (diff) | |
parent | d20bb59af64667a16f2468b54fc0adb2f824a3b6 (diff) |
Merge tag 'tty-4.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
Pull tty and serial driver updates from Greg KH:
"Here's the large TTY and Serial driver update for 4.7-rc1.
A few new serial drivers are added here, and Peter has fixed a bunch
of long-standing bugs in the tty layer and serial drivers as normal.
Full details in the shortlog.
All of these have been in linux-next for a while with no reported
issues"
* tag 'tty-4.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: (88 commits)
MAINTAINERS: 8250: remove website reference
serial: core: Fix port mutex assert if lockdep disabled
serial: 8250_dw: fix wrong logic in dw8250_check_lcr()
tty: vt, finish looping on duplicate
tty: vt, return error when con_startup fails
QE-UART: add "fsl,t1040-ucc-uart" to of_device_id
serial: mctrl_gpio: Drop support for out1-gpios and out2-gpios
serial: 8250dw: Add device HID for future AMD UART controller
Fix OpenSSH pty regression on close
serial: mctrl_gpio: add IRQ locking
serial: 8250: Integrate Fintek into 8250_base
serial: mps2-uart: add support for early console
serial: mps2-uart: add MPS2 UART driver
dt-bindings: document the MPS2 UART bindings
serial: sirf: Use generic uart-has-rtscts DT property
serial: sirf: Introduce helper variable struct device_node *np
serial: mxs-auart: Use generic uart-has-rtscts DT property
serial: imx: Use generic uart-has-rtscts DT property
doc: DT: Add Generic Serial Device Tree Bindings
serial: 8250: of: Make tegra_serial_handle_break() static
...
Diffstat (limited to 'net/irda')
-rw-r--r-- | net/irda/ircomm/ircomm_tty.c | 31 | ||||
-rw-r--r-- | net/irda/ircomm/ircomm_tty_attach.c | 2 | ||||
-rw-r--r-- | net/irda/ircomm/ircomm_tty_ioctl.c | 18 |
3 files changed, 24 insertions, 27 deletions
diff --git a/net/irda/ircomm/ircomm_tty.c b/net/irda/ircomm/ircomm_tty.c index da126ee6d218..873c4b707d6a 100644 --- a/net/irda/ircomm/ircomm_tty.c +++ b/net/irda/ircomm/ircomm_tty.c | |||
@@ -220,10 +220,11 @@ static int ircomm_tty_startup(struct ircomm_tty_cb *self) | |||
220 | IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); | 220 | IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); |
221 | 221 | ||
222 | /* Check if already open */ | 222 | /* Check if already open */ |
223 | if (test_and_set_bit(ASYNCB_INITIALIZED, &self->port.flags)) { | 223 | if (tty_port_initialized(&self->port)) { |
224 | pr_debug("%s(), already open so break out!\n", __func__); | 224 | pr_debug("%s(), already open so break out!\n", __func__); |
225 | return 0; | 225 | return 0; |
226 | } | 226 | } |
227 | tty_port_set_initialized(&self->port, 1); | ||
227 | 228 | ||
228 | /* Register with IrCOMM */ | 229 | /* Register with IrCOMM */ |
229 | irda_notify_init(¬ify); | 230 | irda_notify_init(¬ify); |
@@ -257,7 +258,7 @@ static int ircomm_tty_startup(struct ircomm_tty_cb *self) | |||
257 | 258 | ||
258 | return 0; | 259 | return 0; |
259 | err: | 260 | err: |
260 | clear_bit(ASYNCB_INITIALIZED, &self->port.flags); | 261 | tty_port_set_initialized(&self->port, 0); |
261 | return ret; | 262 | return ret; |
262 | } | 263 | } |
263 | 264 | ||
@@ -280,8 +281,8 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self, | |||
280 | * If non-blocking mode is set, or the port is not enabled, | 281 | * If non-blocking mode is set, or the port is not enabled, |
281 | * then make the check up front and then exit. | 282 | * then make the check up front and then exit. |
282 | */ | 283 | */ |
283 | if (test_bit(TTY_IO_ERROR, &tty->flags)) { | 284 | if (tty_io_error(tty)) { |
284 | port->flags |= ASYNC_NORMAL_ACTIVE; | 285 | tty_port_set_active(port, 1); |
285 | return 0; | 286 | return 0; |
286 | } | 287 | } |
287 | 288 | ||
@@ -289,7 +290,7 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self, | |||
289 | /* nonblock mode is set */ | 290 | /* nonblock mode is set */ |
290 | if (C_BAUD(tty)) | 291 | if (C_BAUD(tty)) |
291 | tty_port_raise_dtr_rts(port); | 292 | tty_port_raise_dtr_rts(port); |
292 | port->flags |= ASYNC_NORMAL_ACTIVE; | 293 | tty_port_set_active(port, 1); |
293 | pr_debug("%s(), O_NONBLOCK requested!\n", __func__); | 294 | pr_debug("%s(), O_NONBLOCK requested!\n", __func__); |
294 | return 0; | 295 | return 0; |
295 | } | 296 | } |
@@ -318,13 +319,12 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self, | |||
318 | spin_unlock_irqrestore(&port->lock, flags); | 319 | spin_unlock_irqrestore(&port->lock, flags); |
319 | 320 | ||
320 | while (1) { | 321 | while (1) { |
321 | if (C_BAUD(tty) && test_bit(ASYNCB_INITIALIZED, &port->flags)) | 322 | if (C_BAUD(tty) && tty_port_initialized(port)) |
322 | tty_port_raise_dtr_rts(port); | 323 | tty_port_raise_dtr_rts(port); |
323 | 324 | ||
324 | set_current_state(TASK_INTERRUPTIBLE); | 325 | set_current_state(TASK_INTERRUPTIBLE); |
325 | 326 | ||
326 | if (tty_hung_up_p(filp) || | 327 | if (tty_hung_up_p(filp) || !tty_port_initialized(port)) { |
327 | !test_bit(ASYNCB_INITIALIZED, &port->flags)) { | ||
328 | retval = (port->flags & ASYNC_HUP_NOTIFY) ? | 328 | retval = (port->flags & ASYNC_HUP_NOTIFY) ? |
329 | -EAGAIN : -ERESTARTSYS; | 329 | -EAGAIN : -ERESTARTSYS; |
330 | break; | 330 | break; |
@@ -365,7 +365,7 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self, | |||
365 | __FILE__, __LINE__, tty->driver->name, port->count); | 365 | __FILE__, __LINE__, tty->driver->name, port->count); |
366 | 366 | ||
367 | if (!retval) | 367 | if (!retval) |
368 | port->flags |= ASYNC_NORMAL_ACTIVE; | 368 | tty_port_set_active(port, 1); |
369 | 369 | ||
370 | return retval; | 370 | return retval; |
371 | } | 371 | } |
@@ -876,8 +876,9 @@ static void ircomm_tty_shutdown(struct ircomm_tty_cb *self) | |||
876 | IRDA_ASSERT(self != NULL, return;); | 876 | IRDA_ASSERT(self != NULL, return;); |
877 | IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;); | 877 | IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;); |
878 | 878 | ||
879 | if (!test_and_clear_bit(ASYNCB_INITIALIZED, &self->port.flags)) | 879 | if (!tty_port_initialized(&self->port)) |
880 | return; | 880 | return; |
881 | tty_port_set_initialized(&self->port, 0); | ||
881 | 882 | ||
882 | ircomm_tty_detach_cable(self); | 883 | ircomm_tty_detach_cable(self); |
883 | 884 | ||
@@ -925,7 +926,6 @@ static void ircomm_tty_hangup(struct tty_struct *tty) | |||
925 | ircomm_tty_shutdown(self); | 926 | ircomm_tty_shutdown(self); |
926 | 927 | ||
927 | spin_lock_irqsave(&port->lock, flags); | 928 | spin_lock_irqsave(&port->lock, flags); |
928 | port->flags &= ~ASYNC_NORMAL_ACTIVE; | ||
929 | if (port->tty) { | 929 | if (port->tty) { |
930 | set_bit(TTY_IO_ERROR, &port->tty->flags); | 930 | set_bit(TTY_IO_ERROR, &port->tty->flags); |
931 | tty_kref_put(port->tty); | 931 | tty_kref_put(port->tty); |
@@ -933,6 +933,7 @@ static void ircomm_tty_hangup(struct tty_struct *tty) | |||
933 | port->tty = NULL; | 933 | port->tty = NULL; |
934 | port->count = 0; | 934 | port->count = 0; |
935 | spin_unlock_irqrestore(&port->lock, flags); | 935 | spin_unlock_irqrestore(&port->lock, flags); |
936 | tty_port_set_active(port, 0); | ||
936 | 937 | ||
937 | wake_up_interruptible(&port->open_wait); | 938 | wake_up_interruptible(&port->open_wait); |
938 | } | 939 | } |
@@ -999,7 +1000,7 @@ void ircomm_tty_check_modem_status(struct ircomm_tty_cb *self) | |||
999 | if (status & IRCOMM_DCE_DELTA_ANY) { | 1000 | if (status & IRCOMM_DCE_DELTA_ANY) { |
1000 | /*wake_up_interruptible(&self->delta_msr_wait);*/ | 1001 | /*wake_up_interruptible(&self->delta_msr_wait);*/ |
1001 | } | 1002 | } |
1002 | if ((self->port.flags & ASYNC_CHECK_CD) && (status & IRCOMM_DELTA_CD)) { | 1003 | if (tty_port_check_carrier(&self->port) && (status & IRCOMM_DELTA_CD)) { |
1003 | pr_debug("%s(), ircomm%d CD now %s...\n", __func__ , self->line, | 1004 | pr_debug("%s(), ircomm%d CD now %s...\n", __func__ , self->line, |
1004 | (status & IRCOMM_CD) ? "on" : "off"); | 1005 | (status & IRCOMM_CD) ? "on" : "off"); |
1005 | 1006 | ||
@@ -1255,11 +1256,11 @@ static void ircomm_tty_line_info(struct ircomm_tty_cb *self, struct seq_file *m) | |||
1255 | seq_printf(m, "%cASYNC_CTS_FLOW", sep); | 1256 | seq_printf(m, "%cASYNC_CTS_FLOW", sep); |
1256 | sep = '|'; | 1257 | sep = '|'; |
1257 | } | 1258 | } |
1258 | if (self->port.flags & ASYNC_CHECK_CD) { | 1259 | if (tty_port_check_carrier(&self->port)) { |
1259 | seq_printf(m, "%cASYNC_CHECK_CD", sep); | 1260 | seq_printf(m, "%cASYNC_CHECK_CD", sep); |
1260 | sep = '|'; | 1261 | sep = '|'; |
1261 | } | 1262 | } |
1262 | if (self->port.flags & ASYNC_INITIALIZED) { | 1263 | if (tty_port_initialized(&self->port)) { |
1263 | seq_printf(m, "%cASYNC_INITIALIZED", sep); | 1264 | seq_printf(m, "%cASYNC_INITIALIZED", sep); |
1264 | sep = '|'; | 1265 | sep = '|'; |
1265 | } | 1266 | } |
@@ -1267,7 +1268,7 @@ static void ircomm_tty_line_info(struct ircomm_tty_cb *self, struct seq_file *m) | |||
1267 | seq_printf(m, "%cASYNC_LOW_LATENCY", sep); | 1268 | seq_printf(m, "%cASYNC_LOW_LATENCY", sep); |
1268 | sep = '|'; | 1269 | sep = '|'; |
1269 | } | 1270 | } |
1270 | if (self->port.flags & ASYNC_NORMAL_ACTIVE) { | 1271 | if (tty_port_active(&self->port)) { |
1271 | seq_printf(m, "%cASYNC_NORMAL_ACTIVE", sep); | 1272 | seq_printf(m, "%cASYNC_NORMAL_ACTIVE", sep); |
1272 | sep = '|'; | 1273 | sep = '|'; |
1273 | } | 1274 | } |
diff --git a/net/irda/ircomm/ircomm_tty_attach.c b/net/irda/ircomm/ircomm_tty_attach.c index 61137f8b5293..0a411019c098 100644 --- a/net/irda/ircomm/ircomm_tty_attach.c +++ b/net/irda/ircomm/ircomm_tty_attach.c | |||
@@ -968,7 +968,7 @@ static int ircomm_tty_state_ready(struct ircomm_tty_cb *self, | |||
968 | ircomm_tty_next_state(self, IRCOMM_TTY_SEARCH); | 968 | ircomm_tty_next_state(self, IRCOMM_TTY_SEARCH); |
969 | ircomm_tty_start_watchdog_timer(self, 3*HZ); | 969 | ircomm_tty_start_watchdog_timer(self, 3*HZ); |
970 | 970 | ||
971 | if (self->port.flags & ASYNC_CHECK_CD) { | 971 | if (tty_port_check_carrier(&self->port)) { |
972 | /* Drop carrier */ | 972 | /* Drop carrier */ |
973 | self->settings.dce = IRCOMM_DELTA_CD; | 973 | self->settings.dce = IRCOMM_DELTA_CD; |
974 | ircomm_tty_check_modem_status(self); | 974 | ircomm_tty_check_modem_status(self); |
diff --git a/net/irda/ircomm/ircomm_tty_ioctl.c b/net/irda/ircomm/ircomm_tty_ioctl.c index d3687aaa23de..d4fdf8f7b471 100644 --- a/net/irda/ircomm/ircomm_tty_ioctl.c +++ b/net/irda/ircomm/ircomm_tty_ioctl.c | |||
@@ -86,21 +86,17 @@ static void ircomm_tty_change_speed(struct ircomm_tty_cb *self, | |||
86 | ircomm_param_request(self, IRCOMM_DATA_RATE, FALSE); | 86 | ircomm_param_request(self, IRCOMM_DATA_RATE, FALSE); |
87 | 87 | ||
88 | /* CTS flow control flag and modem status interrupts */ | 88 | /* CTS flow control flag and modem status interrupts */ |
89 | tty_port_set_cts_flow(&self->port, cflag & CRTSCTS); | ||
89 | if (cflag & CRTSCTS) { | 90 | if (cflag & CRTSCTS) { |
90 | self->port.flags |= ASYNC_CTS_FLOW; | ||
91 | self->settings.flow_control |= IRCOMM_RTS_CTS_IN; | 91 | self->settings.flow_control |= IRCOMM_RTS_CTS_IN; |
92 | /* This got me. Bummer. Jean II */ | 92 | /* This got me. Bummer. Jean II */ |
93 | if (self->service_type == IRCOMM_3_WIRE_RAW) | 93 | if (self->service_type == IRCOMM_3_WIRE_RAW) |
94 | net_warn_ratelimited("%s(), enabling RTS/CTS on link that doesn't support it (3-wire-raw)\n", | 94 | net_warn_ratelimited("%s(), enabling RTS/CTS on link that doesn't support it (3-wire-raw)\n", |
95 | __func__); | 95 | __func__); |
96 | } else { | 96 | } else { |
97 | self->port.flags &= ~ASYNC_CTS_FLOW; | ||
98 | self->settings.flow_control &= ~IRCOMM_RTS_CTS_IN; | 97 | self->settings.flow_control &= ~IRCOMM_RTS_CTS_IN; |
99 | } | 98 | } |
100 | if (cflag & CLOCAL) | 99 | tty_port_set_check_carrier(&self->port, ~cflag & CLOCAL); |
101 | self->port.flags &= ~ASYNC_CHECK_CD; | ||
102 | else | ||
103 | self->port.flags |= ASYNC_CHECK_CD; | ||
104 | #if 0 | 100 | #if 0 |
105 | /* | 101 | /* |
106 | * Set up parity check flag | 102 | * Set up parity check flag |
@@ -166,7 +162,7 @@ void ircomm_tty_set_termios(struct tty_struct *tty, | |||
166 | /* Handle transition away from B0 status */ | 162 | /* Handle transition away from B0 status */ |
167 | if (!(old_termios->c_cflag & CBAUD) && (cflag & CBAUD)) { | 163 | if (!(old_termios->c_cflag & CBAUD) && (cflag & CBAUD)) { |
168 | self->settings.dte |= IRCOMM_DTR; | 164 | self->settings.dte |= IRCOMM_DTR; |
169 | if (!C_CRTSCTS(tty) || !test_bit(TTY_THROTTLED, &tty->flags)) | 165 | if (!C_CRTSCTS(tty) || !tty_throttled(tty)) |
170 | self->settings.dte |= IRCOMM_RTS; | 166 | self->settings.dte |= IRCOMM_RTS; |
171 | ircomm_param_request(self, IRCOMM_DTE, TRUE); | 167 | ircomm_param_request(self, IRCOMM_DTE, TRUE); |
172 | } | 168 | } |
@@ -190,7 +186,7 @@ int ircomm_tty_tiocmget(struct tty_struct *tty) | |||
190 | struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data; | 186 | struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data; |
191 | unsigned int result; | 187 | unsigned int result; |
192 | 188 | ||
193 | if (tty->flags & (1 << TTY_IO_ERROR)) | 189 | if (tty_io_error(tty)) |
194 | return -EIO; | 190 | return -EIO; |
195 | 191 | ||
196 | result = ((self->settings.dte & IRCOMM_RTS) ? TIOCM_RTS : 0) | 192 | result = ((self->settings.dte & IRCOMM_RTS) ? TIOCM_RTS : 0) |
@@ -213,7 +209,7 @@ int ircomm_tty_tiocmset(struct tty_struct *tty, | |||
213 | { | 209 | { |
214 | struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data; | 210 | struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data; |
215 | 211 | ||
216 | if (tty->flags & (1 << TTY_IO_ERROR)) | 212 | if (tty_io_error(tty)) |
217 | return -EIO; | 213 | return -EIO; |
218 | 214 | ||
219 | IRDA_ASSERT(self != NULL, return -1;); | 215 | IRDA_ASSERT(self != NULL, return -1;); |
@@ -328,7 +324,7 @@ static int ircomm_tty_set_serial_info(struct ircomm_tty_cb *self, | |||
328 | 324 | ||
329 | check_and_exit: | 325 | check_and_exit: |
330 | 326 | ||
331 | if (self->flags & ASYNC_INITIALIZED) { | 327 | if (tty_port_initialized(self)) { |
332 | if (((old_state.flags & ASYNC_SPD_MASK) != | 328 | if (((old_state.flags & ASYNC_SPD_MASK) != |
333 | (self->flags & ASYNC_SPD_MASK)) || | 329 | (self->flags & ASYNC_SPD_MASK)) || |
334 | (old_driver.custom_divisor != driver->custom_divisor)) { | 330 | (old_driver.custom_divisor != driver->custom_divisor)) { |
@@ -362,7 +358,7 @@ int ircomm_tty_ioctl(struct tty_struct *tty, | |||
362 | if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) && | 358 | if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) && |
363 | (cmd != TIOCSERCONFIG) && (cmd != TIOCSERGSTRUCT) && | 359 | (cmd != TIOCSERCONFIG) && (cmd != TIOCSERGSTRUCT) && |
364 | (cmd != TIOCMIWAIT) && (cmd != TIOCGICOUNT)) { | 360 | (cmd != TIOCMIWAIT) && (cmd != TIOCGICOUNT)) { |
365 | if (tty->flags & (1 << TTY_IO_ERROR)) | 361 | if (tty_io_error(tty)) |
366 | return -EIO; | 362 | return -EIO; |
367 | } | 363 | } |
368 | 364 | ||