diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-11-14 00:05:31 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-11-14 00:05:31 -0500 |
commit | fb0255fb2941ef6f21742b2bc146d6b9aef4fedc (patch) | |
tree | 8334f3485152b1c887ddfe04ba9a95c8a704481c /drivers/tty/serial/serial_core.c | |
parent | 449fcf3ab0baf3dde9952385e6789f2ca10c3980 (diff) | |
parent | 57f5d648c45c3d40a3257c06629c14fd53c383bc (diff) |
Merge tag 'tty-4.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
Pull tty/serial updates from Greg KH:
"Here is the big tty/serial driver pull request for 4.15-rc1.
Lots of serial driver updates in here, some small vt cleanups, and a
raft of SPDX and license boilerplate cleanups, messing up the diffstat
a bit.
Nothing major, with no realy functional changes except better hardware
support for some platforms.
All of these have been in linux-next for a while with no reported
issues"
* tag 'tty-4.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: (110 commits)
tty: ehv_bytechan: fix spelling mistake
tty: serial: meson: allow baud-rates lower than 9600
serial: 8250_fintek: Fix crash with baud rate B0
serial: 8250_fintek: Disable delays for ports != 0
serial: 8250_fintek: Return -EINVAL on invalid configuration
tty: Remove redundant license text
tty: serdev: Remove redundant license text
tty: hvc: Remove redundant license text
tty: serial: Remove redundant license text
tty: add SPDX identifiers to all remaining files in drivers/tty/
tty: serial: jsm: remove redundant pointer ts
tty: serial: jsm: add space before the open parenthesis '('
tty: serial: jsm: fix coding style
tty: serial: jsm: delete space between function name and '('
tty: serial: jsm: add blank line after declarations
tty: serial: jsm: change the type of local variable
tty: serial: imx: remove dead code imx_dma_rxint
tty: serial: imx: disable ageing timer interrupt if dma in use
serial: 8250: fix potential deadlock in rs485-mode
serial: m32r_sio: Drop redundant .data assignment
...
Diffstat (limited to 'drivers/tty/serial/serial_core.c')
-rw-r--r-- | drivers/tty/serial/serial_core.c | 54 |
1 files changed, 38 insertions, 16 deletions
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index 3a14cccbd7ff..854995e1cae7 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0+ | ||
1 | /* | 2 | /* |
2 | * Driver core for serial ports | 3 | * Driver core for serial ports |
3 | * | 4 | * |
@@ -5,20 +6,6 @@ | |||
5 | * | 6 | * |
6 | * Copyright 1999 ARM Limited | 7 | * Copyright 1999 ARM Limited |
7 | * Copyright (C) 2000-2001 Deep Blue Solutions Ltd. | 8 | * Copyright (C) 2000-2001 Deep Blue Solutions Ltd. |
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
22 | */ | 9 | */ |
23 | #include <linux/module.h> | 10 | #include <linux/module.h> |
24 | #include <linux/tty.h> | 11 | #include <linux/tty.h> |
@@ -1482,10 +1469,10 @@ out: | |||
1482 | static void uart_close(struct tty_struct *tty, struct file *filp) | 1469 | static void uart_close(struct tty_struct *tty, struct file *filp) |
1483 | { | 1470 | { |
1484 | struct uart_state *state = tty->driver_data; | 1471 | struct uart_state *state = tty->driver_data; |
1485 | struct tty_port *port; | ||
1486 | 1472 | ||
1487 | if (!state) { | 1473 | if (!state) { |
1488 | struct uart_driver *drv = tty->driver->driver_state; | 1474 | struct uart_driver *drv = tty->driver->driver_state; |
1475 | struct tty_port *port; | ||
1489 | 1476 | ||
1490 | state = drv->state + tty->index; | 1477 | state = drv->state + tty->index; |
1491 | port = &state->port; | 1478 | port = &state->port; |
@@ -1495,7 +1482,6 @@ static void uart_close(struct tty_struct *tty, struct file *filp) | |||
1495 | return; | 1482 | return; |
1496 | } | 1483 | } |
1497 | 1484 | ||
1498 | port = &state->port; | ||
1499 | pr_debug("uart_close(%d) called\n", tty->index); | 1485 | pr_debug("uart_close(%d) called\n", tty->index); |
1500 | 1486 | ||
1501 | tty_port_close(tty->port, tty, filp); | 1487 | tty_port_close(tty->port, tty, filp); |
@@ -3026,5 +3012,41 @@ EXPORT_SYMBOL(uart_resume_port); | |||
3026 | EXPORT_SYMBOL(uart_add_one_port); | 3012 | EXPORT_SYMBOL(uart_add_one_port); |
3027 | EXPORT_SYMBOL(uart_remove_one_port); | 3013 | EXPORT_SYMBOL(uart_remove_one_port); |
3028 | 3014 | ||
3015 | /** | ||
3016 | * of_get_rs485_mode() - Implement parsing rs485 properties | ||
3017 | * @np: uart node | ||
3018 | * @rs485conf: output parameter | ||
3019 | * | ||
3020 | * This function implements the device tree binding described in | ||
3021 | * Documentation/devicetree/bindings/serial/rs485.txt. | ||
3022 | */ | ||
3023 | void of_get_rs485_mode(struct device_node *np, struct serial_rs485 *rs485conf) | ||
3024 | { | ||
3025 | u32 rs485_delay[2]; | ||
3026 | int ret; | ||
3027 | |||
3028 | ret = of_property_read_u32_array(np, "rs485-rts-delay", rs485_delay, 2); | ||
3029 | if (!ret) { | ||
3030 | rs485conf->delay_rts_before_send = rs485_delay[0]; | ||
3031 | rs485conf->delay_rts_after_send = rs485_delay[1]; | ||
3032 | } else { | ||
3033 | rs485conf->delay_rts_before_send = 0; | ||
3034 | rs485conf->delay_rts_after_send = 0; | ||
3035 | } | ||
3036 | |||
3037 | /* | ||
3038 | * clear full-duplex and enabled flags to get to a defined state with | ||
3039 | * the two following properties. | ||
3040 | */ | ||
3041 | rs485conf->flags &= ~(SER_RS485_RX_DURING_TX | SER_RS485_ENABLED); | ||
3042 | |||
3043 | if (of_property_read_bool(np, "rs485-rx-during-tx")) | ||
3044 | rs485conf->flags |= SER_RS485_RX_DURING_TX; | ||
3045 | |||
3046 | if (of_property_read_bool(np, "linux,rs485-enabled-at-boot-time")) | ||
3047 | rs485conf->flags |= SER_RS485_ENABLED; | ||
3048 | } | ||
3049 | EXPORT_SYMBOL_GPL(of_get_rs485_mode); | ||
3050 | |||
3029 | MODULE_DESCRIPTION("Serial driver core"); | 3051 | MODULE_DESCRIPTION("Serial driver core"); |
3030 | MODULE_LICENSE("GPL"); | 3052 | MODULE_LICENSE("GPL"); |