Jiri Slaby [Tue, 3 May 2016 15:05:55 +0000 (17:05 +0200)]
tty: vt, finish looping on duplicate
When the console is already registered, stop crawling the
registered_con_driver array and return an error immediatelly.
This makes the code more obvious. And we do not need to initialize
retval anymore.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Jiri Slaby [Tue, 3 May 2016 15:05:54 +0000 (17:05 +0200)]
tty: vt, return error when con_startup fails
When csw->con_startup() fails in do_register_con_driver, we return no
error (i.e. 0). This was changed back in 2006 by commit
3e795de763.
Before that we used to return -ENODEV.
So fix the return value to be -ENODEV in that case again.
Fixes:
3e795de763 ("VT binding: Add binding/unbinding support for the VT console")
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Reported-by: "Dan Carpenter" <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Zhao Qiang [Wed, 9 Mar 2016 01:48:11 +0000 (09:48 +0800)]
QE-UART: add "fsl,t1040-ucc-uart" to of_device_id
New bindings use "fsl,t1040-ucc-uart" as the compatible for qe-uart.
So add it.
Signed-off-by: Zhao Qiang <qiang.zhao@nxp.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Geert Uytterhoeven [Fri, 29 Apr 2016 11:40:26 +0000 (13:40 +0200)]
serial: mctrl_gpio: Drop support for out1-gpios and out2-gpios
The OUT1 and OUT2 pins present on some legacy UARTs are basically GPIOs.
It doesn't make much sense to emulate GPIOs using other GPIOs, hence
drop support for that.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Peter Hurley <peter@hurleysoftware.com>
Reviewed-by: Richard Genoud <richard.genoud@gmail.com>
Reviewed-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Wang Hongcheng [Fri, 11 Mar 2016 01:40:11 +0000 (09:40 +0800)]
serial: 8250dw: Add device HID for future AMD UART controller
Add device HID AMDI0020 to match the AMD ACPI Vendor ID (AMDI) as
registered in http://www.uefi.org/acpi_id_list, and the UART
controller on future AMD paltform will use the HID instead of AMD0020.
Signed-off-by: Wang Hongcheng <annie.wang@amd.com>
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Brian Bloniarz [Sun, 6 Mar 2016 21:16:30 +0000 (13:16 -0800)]
Fix OpenSSH pty regression on close
OpenSSH expects the (non-blocking) read() of pty master to return
EAGAIN only if it has received all of the slave-side output after
it has received SIGCHLD. This used to work on pre-3.12 kernels.
This fix effectively forces non-blocking read() and poll() to
block for parallel i/o to complete for all ttys. It also unwinds
these changes:
1)
f8747d4a466ab2cafe56112c51b3379f9fdb7a12
tty: Fix pty master read() after slave closes
2)
52bce7f8d4fc633c9a9d0646eef58ba6ae9a3b73
pty, n_tty: Simplify input processing on final close
3)
1a48632ffed61352a7810ce089dc5a8bcd505a60
pty: Fix input race when closing
Inspired by analysis and patch from Marc Aurele La France <tsi@tuyoix.net>
Reported-by: Volth <openssh@volth.com>
Reported-by: Marc Aurele La France <tsi@tuyoix.net>
BugLink: https://bugzilla.mindrot.org/show_bug.cgi?id=52
BugLink: https://bugzilla.mindrot.org/show_bug.cgi?id=2492
Signed-off-by: Brian Bloniarz <brian.bloniarz@gmail.com>
Reviewed-by: Peter Hurley <peter@hurleysoftware.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Yegor Yefremov [Fri, 29 Apr 2016 08:45:07 +0000 (10:45 +0200)]
serial: mctrl_gpio: add IRQ locking
uart_handle_cts_change should be called with port->lock held. And for
this to be save you must also disable irqs.
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ricardo Ribalda Delgado [Wed, 27 Apr 2016 08:40:10 +0000 (10:40 +0200)]
serial: 8250: Integrate Fintek into 8250_base
The 8250_fintek driver advertises as the PNP0501 driver; however this
conflicts with the standard 16550A uart PNP0501. The conflict causes
the 8250_fintek driver to load with _every_ PNP0501, but never probe,
and causing the entire 8250 driver stack to unload if the 8250_fintek
driver is unloaded (modprobe doesn't know that 8250_pnp rather than
8250_fintek claimed the resource).
This patch merges the Fintek driver into 8250_base. On autoconfig_16550
the device is probed to verify if it is a FINTEK device or not.
This custom probing can be disabled completely via configuration. When a
Fintek device is not probed it will behave as a standard 16550A device,
with no RS485 capabilities.
Reported-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Reviewed-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Vladimir Murzin [Mon, 25 Apr 2016 08:47:48 +0000 (09:47 +0100)]
serial: mps2-uart: add support for early console
This adds support early console for MPS2 UART which can be enabled via
earlycon=mps2,0x40004000
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Vladimir Murzin [Mon, 25 Apr 2016 08:47:47 +0000 (09:47 +0100)]
serial: mps2-uart: add MPS2 UART driver
This driver adds support to the UART controller found on ARM MPS2
platform.
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Vladimir Murzin [Mon, 25 Apr 2016 08:47:46 +0000 (09:47 +0100)]
dt-bindings: document the MPS2 UART bindings
This adds documentation of device tree bindings for the
UART found on ARM MPS2 platform
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Geert Uytterhoeven [Fri, 22 Apr 2016 15:22:24 +0000 (17:22 +0200)]
serial: sirf: Use generic uart-has-rtscts DT property
Convert the SiRF UART driver from using the vendor-specific
"sirf,uart-has-rtscts" to the generic "uart-has-rtscts" DT property, as
documented by the Generic Serial DT Bindings.
The old vendor-specific property is still recognized by the driver for
backwards compatibility, but deprecated.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Geert Uytterhoeven [Fri, 22 Apr 2016 15:22:23 +0000 (17:22 +0200)]
serial: sirf: Introduce helper variable struct device_node *np
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Geert Uytterhoeven [Fri, 22 Apr 2016 15:22:22 +0000 (17:22 +0200)]
serial: mxs-auart: Use generic uart-has-rtscts DT property
Convert the Freescale MXS AUART driver from using the vendor-specific
"fsl,uart-has-rtscts" to the generic "uart-has-rtscts" DT property, as
documented by the Generic Serial DT Bindings.
The old vendor-specific property is still recognized by the driver for
backwards compatibility, but it is deprecated.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Geert Uytterhoeven [Fri, 22 Apr 2016 15:22:21 +0000 (17:22 +0200)]
serial: imx: Use generic uart-has-rtscts DT property
Convert the Freescale IMX UART driver from using the vendor-specific
"fsl,uart-has-rtscts" to the generic "uart-has-rtscts" DT property, as
documented by the Generic Serial DT Bindings.
The old vendor-specific property is still recognized by the driver for
backwards compatibility, but deprecated.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Geert Uytterhoeven [Fri, 22 Apr 2016 15:22:20 +0000 (17:22 +0200)]
doc: DT: Add Generic Serial Device Tree Bindings
Document a set of generic properties for describing UARTs in a
device tree:
1. The GPIO modem control properties are currently duplicated across
hardware-specific binding documentation,
2. The property for dedicated RTS/CTS hardware flow control lines is
already supported by several drivers, albeit with a vendor-specific
prefix, hence make it generic.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Rob Herring <rob@kernel.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Thierry Reding [Thu, 28 Apr 2016 12:47:24 +0000 (14:47 +0200)]
serial: 8250: of: Make tegra_serial_handle_break() static
This function is not used outside the file, so it can be static.
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Peter Hurley [Sun, 10 Apr 2016 05:14:37 +0000 (22:14 -0700)]
serial: omap8250: Terminate rx dma only for flushes
DMA completed normally does not require termination; only terminate
paused rx dma stemming from rx dma flush.
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Peter Hurley [Sun, 10 Apr 2016 05:14:36 +0000 (22:14 -0700)]
serial: 8250: Extract IIR logic steering from rx dma
Using fake IIR values to perform rx dma operations unnecessarily
conflates separate operations, stopping in-progress dma with starting
new dma.
Introduce serial8250_rx_dma_flush() to handle stopping in-progress dma
[omap8250 already has equivalent omap_8250_rx_dma_flush()].
Replace rx_dma(UART_IIR_RX_TIMEOUT) with the equivalent *_rx_dma_flush(),
and rx_dma(0) with the equivalent *_rx_dma(). Handle IIR steering
in the irq handler with handle_rx_dma() helper.
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Peter Hurley [Sun, 10 Apr 2016 05:14:35 +0000 (22:14 -0700)]
serial: omap8250: Simplify rx dma completion interface
Extract the operation (restarting new rx dma) performed when error
argument is true.
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Peter Hurley [Sun, 10 Apr 2016 05:14:34 +0000 (22:14 -0700)]
serial: omap8250: Drop rx buffer sync
commit
27c310c5c312 ("serial: 8250_dma: no need to sync RX buffer")
notes the RX DMA buffer is allocated from DMA coherent memory, and
thus does not need sync'd for each transaction. The same is true
for OMAP RX DMA.
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Peter Hurley [Sun, 10 Apr 2016 05:14:33 +0000 (22:14 -0700)]
serial: 8250: Validate dmaengine tx chan meets requirements
8250 dma support requires the dmaegine driver support terminate.
Query slave caps to determine if necessary commands/properties are
supported; disable dma if not.
Note this means dmaengine driver must support slave caps reporting
as well.
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Peter Hurley [Sun, 10 Apr 2016 05:14:32 +0000 (22:14 -0700)]
serial: 8250: Validate dmaengine rx chan meets requirements
8250 dma support requires the dmaengine driver support error-free
pause/terminate and better-than-descriptor residue granularity. Query
slave caps to determine if necessary commands/properties are supported;
disable dma if not.
Note this means dmaengine driver must support slave caps reporting
as well.
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Thierry Reding [Thu, 28 Apr 2016 12:48:05 +0000 (14:48 +0200)]
serial: tegra: Remove unused variable
The local mcr variable is never used in the tegra_uart_set_mctrl()
function, so it should be removed.
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Geert Uytterhoeven [Fri, 22 Apr 2016 15:29:16 +0000 (17:29 +0200)]
serial: Move Marvell UART DT bindings to correct location
All other UART DT binding documentation is under
Documentation/devicetree/bindings/serial/.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Maarten Brock [Fri, 22 Apr 2016 16:19:33 +0000 (18:19 +0200)]
serial-uartlite: Constify uartlite_be/uartlite_le
Made uartlite_be and uartlite_le constants.
Signed-off-by: Maarten Brock <m.brock@vanmierlo.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Masahiro Yamada [Thu, 21 Apr 2016 06:13:19 +0000 (15:13 +0900)]
serial: 8250_uniphier: add "\n" at the end of error log
Just in case.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Dan Carpenter [Wed, 13 Apr 2016 06:44:31 +0000 (09:44 +0300)]
tty: hvc_console: silence unintialized variable warning
If ->get_char() returns a negative error code and that can mean that
"ch" is uninitialized. The callers of this function expect NO_POLL_CHAR
on error so let's return that.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sudip Mukherjee [Wed, 6 Apr 2016 10:44:04 +0000 (11:44 +0100)]
tty: synclink: remove unneeded test
We reach this point of code after a test of 'info->port.tty->hw_stopped',
we do not need to test for 'info->port.tty' as it is obvious that
info->port.tty is not NULL now, we have already dereferenced it.
Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sudip Mukherjee [Wed, 6 Apr 2016 11:25:39 +0000 (12:25 +0100)]
tty: ipwireless: fix possible NULL dereference
The function alloc_ctrl_packet() can fail and return NULL. Incase it
fails print an error message and exit.
Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Reviewed-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Peter Hurley [Sun, 10 Apr 2016 03:49:44 +0000 (20:49 -0700)]
serial: 8250: Remove unused define
HIGH_BITS_OFFSET is only used in the serial core; remove from 8250-
specific header.
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Peter Hurley [Sun, 10 Apr 2016 03:49:43 +0000 (20:49 -0700)]
serial: omap8250: Eliminate local in omap8250_runtime_resume()
Eliminate 'loss_cntx' local variable.
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Peter Hurley [Sun, 10 Apr 2016 03:49:42 +0000 (20:49 -0700)]
serial: 8250: Reduce expr in 8250 irq handler
If !up->dma == F, then up->dma == T and can be elided from the
(up->dma && up->dma->tx_err) sub-expression.
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Peter Hurley [Sun, 10 Apr 2016 03:49:41 +0000 (20:49 -0700)]
serial: 8250: Eliminate needless local in irq handlers
dma_err is not used other than for boolean evaluation;
substitute the actual operation directly.
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Andy Shevchenko [Mon, 4 Apr 2016 14:35:13 +0000 (17:35 +0300)]
serial: 8250_mid: correct comment regarding Tangier HSU
On Intel Penwell and Tangier the HSU block (3 HSU ports) has a global register
set which is currently not used by the driver. On Tangier it has it's own PCI
device and thus available for enumeration. Since it's not a real HSU port we
just skip it and therefore put a comment in the code why we do so.
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Andy Shevchenko [Mon, 4 Apr 2016 14:35:12 +0000 (17:35 +0300)]
serial: 8250_mid: make module available only on X86
There is no reason to compile module on non-X86 platforms, though COMPILE_TEST
is provided for sake of what it does.
While here, set default to SERIAL_8250 that user doesn't need an explicit
option to be set and hide it from non-expert.
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Andy Shevchenko [Mon, 4 Apr 2016 14:35:11 +0000 (17:35 +0300)]
serial: 8250_mid: include missed linux/bitops.h
The BIT() macro, that is definded in bitops.h, is used in the driver. Include
necessary header for that.
While here, reorder included headers alphabetically.
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Andy Shevchenko [Mon, 4 Apr 2016 14:35:10 +0000 (17:35 +0300)]
serial: 8250_mid: recognize interrupt source in handler
There is a special register that shows interrupt status by source. In
particular case the source can be a combination of DMA Tx, DMA Rx, and UART.
Read the register and call the handlers only for sources that request an
interrupt.
Fixes:
6ede6dcd87aa ("serial: 8250_mid: add support for DMA engine handling from UART MMIO")
Cc: stable@vger.kernel.org
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Andy Shevchenko [Mon, 4 Apr 2016 14:35:09 +0000 (17:35 +0300)]
serial: 8250_mid: use proper bar for DNV platform
Unlike Intel Medfield and Tangier platforms DNV uses PCI BAR0 for IO compatible
resources and BAR1 for MMIO. We need latter in a way to support DMA. Introduce
an additional field in the internal structure and pass PCI BAR based on device
ID.
Reported-by: "Lai, Poey Seng" <poey.seng.lai@intel.com>
Fixes:
6ede6dcd87aa ("serial: 8250_mid: add support for DMA engine handling from UART MMIO")
Cc: stable@vger.kernel.org
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Wan Ahmad Zainie [Wed, 6 Apr 2016 04:06:52 +0000 (12:06 +0800)]
serial: 8250_pci: report DCD and DSR signals as active for Bay Trail
Bay Trail UART port does not support DCD and DSR lines. The driver
shall report that these signals are permanently active. This patch
is for HSUART enumerated via PCI.
For ACPI, see commit
dfd37668ea6d ("serial: 8250_dw: Fix get_mctrl
behaviour"). The commit also describes the possible issue if these
signals are enabled on a port without these pins.
Signed-off-by: Wan Ahmad Zainie <wan.ahmad.zainie.wan.mohamad@intel.com>
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Wan Ahmad Zainie [Wed, 6 Apr 2016 04:06:51 +0000 (12:06 +0800)]
serial: 8250: export get_mctrl function
Exposes get_mctrl() function so that it can be overriden with platform
specific implementation.
Signed-off-by: Wan Ahmad Zainie <wan.ahmad.zainie.wan.mohamad@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Jiri Slaby [Thu, 31 Mar 2016 08:23:34 +0000 (10:23 +0200)]
TTY: serial/ifx6x60, initialize more
In ifx_spi_complete, 'more' is not initialized. It is set only if the
status is clear and only if the header is parsed OK. If any of those
is not true, 'more' can be used uninitialized in that function later.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Jiri Slaby [Thu, 31 Mar 2016 08:08:17 +0000 (10:08 +0200)]
tty: vt, use proper type for default colors
Every user of default_red, default_grn, and default_blu treats them as
unsigned char. So make it really unsigned char.
And indent the initializers and module_param properly.
This saves ~ 100 bytes of data.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Jiri Slaby [Thu, 31 Mar 2016 08:08:16 +0000 (10:08 +0200)]
tty: vt, make color_table const
This means all ->con_set_palette have to have the second parameter
const too now.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Jiri Slaby [Thu, 31 Mar 2016 08:08:15 +0000 (10:08 +0200)]
tty: vt, get rid of weird source code flow
Some code in vc_allocate is indented by 4 spaces. It is inside a
condition. Invert the condition and move the code to the first
indentation level (using \tab). And insert some empty lines to have
logical code blocks separated.
Then, instead of freeing in an 'if' false branch, use goto-error
label as fail path.
Maybe better to look at this patch with diff -w -b.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Jiri Slaby [Thu, 31 Mar 2016 08:08:14 +0000 (10:08 +0200)]
tty: vt, remove reduntant check
MAX_NR_CONSOLES and MAX_NR_USER_CONSOLES are both 63 since they were
introduced in 1.1.54. And since vc_allocate does:
if (currcons >= MAX_NR_CONSOLES)
return -ENXIO;
if (!vc_cons[currcons].d) {
if (currcons >= MAX_NR_USER_CONSOLES && !capable(CAP_SYS_RESOURCE))
return -EPERM;
}
the second check is pointless. Remove both the check and the macro
MAX_NR_USER_CONSOLES.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Reported-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Chanwoo Choi [Thu, 21 Apr 2016 09:58:31 +0000 (18:58 +0900)]
serial: samsung: Reorder the sequence of clock control when call s3c24xx_serial_set_termios()
This patch fixes the broken serial log when changing the clock source
of uart device. Before disabling the original clock source, this patch
enables the new clock source to protect the clock off state for a split second.
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Matthias Schiffer [Thu, 24 Mar 2016 15:02:52 +0000 (16:02 +0100)]
MIPS: ath79: make bootconsole wait for both THRE and TEMT
This makes the ath79 bootconsole behave the same way as the generic 8250
bootconsole.
Also waiting for TEMT (transmit buffer is empty) instead of just THRE
(transmit buffer is not full) ensures that all characters have been
transmitted before the real serial driver starts reconfiguring the serial
controller (which would sometimes result in garbage being transmitted.)
This change does not cause a visible performance loss.
In addition, this seems to fix a hang observed in certain configurations on
many AR7xxx/AR9xxx SoCs during autoconfig of the real serial driver.
A more complete follow-up patch will disable 8250 autoconfig for ath79
altogether (the serial controller is detected as a 16550A, which is not
fully compatible with the ath79 serial, and the autoconfig may lead to
undefined behavior on ath79.)
Cc: <stable@vger.kernel.org>
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Stephen Boyd [Fri, 25 Mar 2016 21:35:49 +0000 (14:35 -0700)]
tty: serial: msm: Support more bauds
The msm_find_best_baud() function is written with the assumption
that the port->uartclk rate is fixed to a particular rate at boot
time, but now this driver changes that clk rate at runtime when
the baud is changed.
The way the hardware works is that an input clk rate comes from
the clk controller into the uart hw block. That rate is typically
1843200 or 3686400 Hz. That rate can then be divided by an
internal divider in the hw block to achieve a particular baud on
the serial wire. msm_find_best_baud() is looking for that divider
value.
A few things are wrong with the way the code is written. First,
it assumes that the maximum baud that the uart can support if the
clk rate is fixed at boot is 460800, which would correspond to an
input clk rate of 230400 * 16 == 3686400 Hz. Except some devices
have a boot rate of 1843200 Hz or max baud of 115200, so
achieving 230400 on those devices doesn't work at all because we
don't increase the clk rate unless max baud is 460800.
Second, we can't achieve bauds higher than 460800 that require
anything besides a divisor of 1, because we always call
msm_find_best_baud() with a fixed port->uartclk rate that will
eventually be changed after we calculate the divisor. So if we
need to get a baud of 500000, we'll just multiply that by 16 and
hope that the clk can give us 500000 * 16 == 8000000 Hz, which it
typically can't do. To really achieve 500000 baud, we need to get
an input clk rate of
24000000 Hz and then divide that by 3 inside
the uart hardware.
Finally, we return success for bauds even when we can't actually
achieve them. This means that when the user asks for 500000 baud,
we actually get 921600 right now, but the user doesn't know that.
Fix all of this by searching through the divisor and clk rate
space with a combination of clk_round_rate() and baud
calculations, keeping track of the best clk rate and divisor we
find if we can't get an exact match. Typically we can get an
exact match with a divisor of 1, but sometimes we need to keep
track and try more frequencies. On my msm8916 device, this
results in all standard bauds in baud_table being supported
except for 1800, 576000, 1152000, and 4000000.
Fixes:
850b37a71bde ("tty: serial: msm: Remove 115.2 Kbps maximum baud rate limitation")
Cc: "Ivan T. Ivanov" <iivanov.xz@gmail.com>
Cc: Matthew McClintock <mmcclint@codeaurora.org>
Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
Tested-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Acked-by: Andy Gross <andy.gross@linaro.org>
Acked-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Tested-by: Cristian Prundeanu <cprundea@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Uwe Kleine-König [Thu, 24 Mar 2016 13:24:25 +0000 (14:24 +0100)]
serial: imx: implement DSR irq handling for DTE mode
Enable reporting of DSR events (which is named DTR in the registers
because Freescale uses the names as seem from a DCE).
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Uwe Kleine-König [Thu, 24 Mar 2016 13:24:24 +0000 (14:24 +0100)]
serial: imx: reorder functions to simplify next patch
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Uwe Kleine-König [Thu, 24 Mar 2016 13:24:23 +0000 (14:24 +0100)]
serial: imx: only count 0->1 transitions for RNG
According to tty_ioctl(4) (from man-pages 4.04) the rng member only
counts 0->1 transitions. For the other signals (DSR, CD, CTS) both edges
are supposed to be counted.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Uwe Kleine-König [Thu, 24 Mar 2016 13:24:22 +0000 (14:24 +0100)]
serial: imx: make sure unhandled irqs are disabled
Make sure that events that are not handled in the irq function don't
trigger an interrupt.
When the serial port is operated in DTE mode, the events for DCD and RI
events are enabled after a system reset by default.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Uwe Kleine-König [Thu, 24 Mar 2016 13:24:21 +0000 (14:24 +0100)]
serial: imx: let irq handler return IRQ_NONE if no event was handled
This gives the irq core a chance to disable the serial interrupt in case
an event isn't cleared in the handler.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Uwe Kleine-König [Thu, 24 Mar 2016 13:24:20 +0000 (14:24 +0100)]
serial: imx: fix polarity of RI
When in DTE mode, the bit USR2_RIIN is active low. So invert the logic
accordingly.
Fixes:
90ebc4838666 ("serial: imx: repair and complete handshaking")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Julia Lawall [Mon, 18 Apr 2016 14:55:37 +0000 (16:55 +0200)]
TTY: add __init attribute
Add __init attribute on a function that is only called from other __init
functions and that is not inlined, at least with gcc version 4.8.4 on an
x86 machine with allyesconfig. Currently, the function is put in the
.text.unlikely segment. Declaring it as __init will cause it to be put in
the .init.text and to disappear after initialization.
The result of objdump -x on the function before the change is as follows:
000000000000014c l F .text.unlikely
0000000000000a2e init_r_port
And after the change it is as follows:
0000000000000000 l F .init.text
0000000000000a29 init_r_port
Done with the help of Coccinelle. The semantic patch checks for local
static non-init functions that are called from an __init function and are
not called from any other function.
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Oleksij Rempel [Wed, 16 Mar 2016 13:05:52 +0000 (14:05 +0100)]
serial: mxs-auart: add Alphascale ASM9260 support
Alphascale ASM9260 uart IP has some common registers with
Freescale STMP37XX. This patch provide changes which
allow to reuse mxs-auart.c code for ASM9260.
Reviewed-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Wills Wang [Sat, 5 Mar 2016 14:09:05 +0000 (22:09 +0800)]
sc16is7xx: remove useless "uart_handle_cts_change"
SC16is7xx has feature for auto hardware flow control using RTS/CTS,
so we don't need "uart_handle_cts_change" to invoke "start_tx/stop_tx"
for flow control.
In addition, for software CTS, interrupt "SC16IS7XX_IIR_CTSRTS_SRC"
just report the nCTS change of state from active(low) to inactive(high),
driver don't know when the state of nCTS change from incactive to active,
so can't resume the transmission when a peer device is again ready and
re-assert nRTS signal.
Signed-off-by: Wills Wang <wills.wang@live.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Geert Uytterhoeven [Thu, 14 Apr 2016 10:01:32 +0000 (12:01 +0200)]
serial: mctrl_gpio: Grammar s/lines GPIOs/line GPIOs/, /sets/set/
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Baruch Siach [Mon, 29 Feb 2016 12:34:10 +0000 (14:34 +0200)]
serial: imx: support RS-485 Rx disable on Tx
Some RS-232 to RS-485 transceivers require Rx to be disabled on Tx to
avoid echo of Tx data into the Rx buffer. Specifically, the XR3160E
RS-232/RS-485/RS-422 transceiver behaves this way.
This commit disables Rx on active Tx when SER_RS485_ENABLED is active and
SER_RS485_RX_DURING_TX is disabled.
Note that this is a change in behavior of the driver. Until now
SER_RS485_RX_DURING_TX was enabled unconditionally even when disabled in
the TIOCSRS485 ioctl serial_rs485 flags field.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Geert Uytterhoeven [Fri, 18 Mar 2016 12:45:51 +0000 (13:45 +0100)]
serial: Make SERIAL_MVEBU_UART depend on ARCH_MVEBU
Enabling support for the UART on Marvell EBU SoCs only make sense when
compiling for Marvell EBU SoCs, unless compile-testing.
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Paul Gortmaker [Sun, 13 Mar 2016 23:48:52 +0000 (19:48 -0400)]
drivers/tty: make serial/mvebu-uart.c explicitly non-modular
The Kconfig currently controlling compilation of this code is:
drivers/tty/serial/Kconfig:config SERIAL_MVEBU_UART
drivers/tty/serial/Kconfig: bool "Marvell EBU serial port support"
...meaning that it currently is not being built as a module by anyone.
Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.
We explicitly disallow a driver unbind, since that doesn't have a
sensible use case anyway, and it allows us to drop the ".remove"
code for non-modular drivers.
Since the code wasn't using module_init to begin with, the init ordering
remains unchanged with this commit.
Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.
We also delete the MODULE_LICENSE tag etc. since all that information
was (or is now) contained at the top of the file in the comments.
Cc: Wilson Ding <dingwei@marvell.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jiri Slaby <jslaby@suse.com>
Cc: linux-serial@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Julia Lawall [Sun, 6 Mar 2016 03:20:12 +0000 (12:20 +0900)]
serial: mvebu-uart: fix platform_no_drv_owner.cocci warnings
No need to set .owner here. The core will do it.
Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci
CC: Wilson Ding <dingwei@marvell.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Andreas Färber [Sun, 6 Mar 2016 11:21:24 +0000 (12:21 +0100)]
tty: serial: meson: Implement earlycon support
Split off the bulk of the existing meson_serial_console_write()
implementation into meson_serial_port_write() for implementing
meson_serial_early_console_write().
Use "meson" as the earlycon driver name, courtesy of Nicolas.
Signed-off-by: Nicolas Saenz Julienne <nicolassaenzj@gmail.com>
Acked-by: Carlo Caione <carlo@endlessm.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Srinivas Kandagatla [Mon, 7 Mar 2016 02:46:40 +0000 (02:46 +0000)]
tty: msm_serial: remove static clk rate setting in probe
The issue with setting up a fixed clock rate at probe is that it would
overwrite the console rate set by the bootloader for its console device.
This would result in serial out corruption or missing log when we system
is booted with earlycon. This is not a issue if we boot system without
earlycon.
This setup is at least not required with the mainline driver, this code
used to be required because the clk_enable() call would fail if
clk_set_rate() wasn't called first.
Originally the issue was noticed on DB410c which is based on APQ8016
chipset.
Without this patch the console log with earlycon would look like:
...
[ 0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=64, nr_cpu_ids=1
[ 0.000000] NR_IRQS:64 nr_irqs:64 0
����+HH��0.699378] console [ttyMSM0] enabled
[ 0.699378] console [ttyMSM0] enabled
[ 0.702003] bootconsole [uart0] disabled
[ 0.702003] bootconsole [uart0] disabled
...
with this patch I can see all the skipped lines on the console
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Acked-by: Andy Gross <andy.gross@linaro.org>
Tested-by: Pramod Gurav <gpramod@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Peter Hurley [Sun, 10 Apr 2016 03:36:39 +0000 (20:36 -0700)]
tty: Remove stale parameter comment
noctty was removed as a parameter by commit
11e1d4aa4da
("tty: Consolidate noctty check in tty_open()").
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Peter Hurley [Sun, 10 Apr 2016 03:36:38 +0000 (20:36 -0700)]
tty: Remove unused TTY_NUMBER() macro
TTY_NUMBER() has been unused since v2.5.71; removed by
"[PATCH] callout removal: callout is gone".
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Peter Hurley [Sun, 10 Apr 2016 01:56:35 +0000 (18:56 -0700)]
serial: core: Prevent unsafe uart port access, part 3
For tty operations which may expect uart port to have been removed
but still have other necessary work to accomplish, check for NULL
uart port; specifically uart_close(), uart_hangup() and sub-functions
(uart_shutdown() and uart_port_shutdown()).
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Peter Hurley [Sun, 10 Apr 2016 01:56:34 +0000 (18:56 -0700)]
serial: core: Prevent unsafe uart port access, part 2
For serial core operations not already excluded by holding port->mutex,
use reference counting to protect deferencing the state->uart_port.
Introduce helper functions, uart_port_ref() and uart_port_deref(), to
wrap uart_port access, and helper macros, uart_port_lock() and
uart_port_unlock(), to wrap combination uart_port access with uart
port lock sections.
Port removal in uart_remove_one_port() waits for reference count to
drop to zero before detaching the uart port from struct uart_state.
For functions only reading the tx circular buffer indexes (where the
uart port lock is claimed to prevent concurrent users), a NULL uart
port is simply ignored and the operation completes normally.
For functions change the tx circular buffer indexes (where the uart
port lock is claimed to prevent concurrent users), the operation is
aborted if the uart port is NULL (ie., has been detached).
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Peter Hurley [Sun, 10 Apr 2016 01:56:33 +0000 (18:56 -0700)]
serial: core: Prevent unsafe uart port access, part 1
uart_remove_one_port() may race with every serial core operation
requiring a valid dereference of state->uart_port. In particular,
uart_remove_one_port() may unlink the uart port concurrently with
any serial core operation that may dereference same.
Ensure safe dereference for those operations that already claim
the port->mutex, and extend that guarantee for trivial cases,
such as the ioctl handlers. Introduce the uart_port_check() helper
which asserts port->mutex is held (only when lockdep is on).
For ioctls, return -EIO as if the port has been hung up (since it has).
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Peter Hurley [Sun, 10 Apr 2016 01:56:32 +0000 (18:56 -0700)]
serial: core: Expand port mutex section in uart_poll_init()
Prepare uart_poll_init() to safely dereference uart port; expand the
port mutex section to guarantee uart port remains valid until
uart_poll_init() completes.
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Peter Hurley [Sun, 10 Apr 2016 00:53:27 +0000 (17:53 -0700)]
tty: core: Undefine ASYNC_* flags superceded by TTY_PORT* flags
Purposefully break out-of-tree driver compiles using kernel
ASYNC_* bits which have been superceded by TTY_PORT* flags and
their respective helper functions.
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Peter Hurley [Sun, 10 Apr 2016 00:53:26 +0000 (17:53 -0700)]
tty: mxser: Remove unused ASYNC_SHARE_IRQ flag
ASYNC*_SHARE_IRQ is no longer used; remove.
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Peter Hurley [Sun, 10 Apr 2016 00:53:25 +0000 (17:53 -0700)]
tty: Replace ASYNC_INITIALIZED bit and update atomically
Replace ASYNC_INITIALIZED bit in the tty_port::flags field with
TTY_PORT_INITIALIZED bit in the tty_port::iflags field. Introduce helpers
tty_port_set_initialized() and tty_port_initialized() to abstract
atomic bit ops.
Note: the transforms for test_and_set_bit() and test_and_clear_bit()
are unnecessary as the state transitions are already mutually exclusive;
the tty lock prevents concurrent open/close/hangup.
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Peter Hurley [Sun, 10 Apr 2016 00:53:24 +0000 (17:53 -0700)]
tty: Replace ASYNC_SUSPENDED bit and update atomically
Replace ASYNC_SUSPENDED bit in the tty_port::flags field with
TTY_PORT_SUSPENDED bit in the tty_port::iflags field. Introduce helpers
tty_port_set_suspended() and tty_port_suspended() to abstract
atomic bit ops.
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Peter Hurley [Sun, 10 Apr 2016 00:53:23 +0000 (17:53 -0700)]
tty: Replace ASYNC_CHECK_CD and update atomically
Replace ASYNC_CHECK_CD bit in the tty_port::flags field with
TTY_PORT_CHECK_CD bit in the tty_port::iflags field. Introduce helpers
tty_port_set_check_carrier() and tty_port_check_carrier() to abstract
the atomic bit ops.
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Peter Hurley [Sun, 10 Apr 2016 00:53:22 +0000 (17:53 -0700)]
tty: Replace ASYNC_NORMAL_ACTIVE bit and update atomically
Replace ASYNC_NORMAL_ACTIVE bit in the tty_port::flags field with
TTY_PORT_ACTIVE bit in the tty_port::iflags field. Introduce helpers
tty_port_set_active() and tty_port_active() to abstract atomic bit ops.
Extract state changes from port lock sections, as this usage is
broken and confused; the state transitions are protected by the
tty lock (which mutually excludes parallel open/close/hangup),
and no user tests the active state while holding the port lock.
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Peter Hurley [Sun, 10 Apr 2016 00:53:21 +0000 (17:53 -0700)]
tty: Replace ASYNC_CTS_FLOW bit and update atomically
Replace ASYNC_CTS_FLOW bit in the tty_port::flags field with
TTY_PORT_CTS_FLOW bit in the tty_port::iflags field. Add
tty_port_set_cts_flow() helper to abstract the atomic bit ops.
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Peter Hurley [Sun, 10 Apr 2016 00:53:20 +0000 (17:53 -0700)]
tty: Define ASYNC_ replacement bits
Prepare for relocating kernel private state bits out of tty_port::flags
field; tty_port::flags field is not atomic and can become corrupted
by concurrent updates. It also suffers from the complication of sharing
in a userspace-visible field which must be masked.
Define new tty_port::iflags field and new, substitute bit definitions
for the former ASYNC_* flags.
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Peter Hurley [Sun, 10 Apr 2016 00:11:36 +0000 (17:11 -0700)]
tty: Replace TTY_THROTTLED bit tests with tty_throttled()
Abstract TTY_THROTTLED bit tests with tty_throttled().
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Peter Hurley [Sun, 10 Apr 2016 00:06:48 +0000 (17:06 -0700)]
tty: Replace TTY_IO_ERROR bit tests with tty_io_error()
Abstract TTY_IO_ERROR status test treewide with tty_io_error().
NB: tty->flags uses atomic bit ops; replace non-atomic bit test
with test_bit().
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Christopher Covington [Fri, 1 Apr 2016 21:23:58 +0000 (17:23 -0400)]
tty: amba-pl011: Use 32-bit accesses for SBSA UART
Version 2 of the Server Base System Architecture (SBSAv2) describes UART
hardware registers as 32 bits wide, giving no guidance on access sizes. The
SBSA UART driver previously assumed partial-length 16 and 8 bit accesses would
work. But the SBSAv2 UART hardware on the Qualcomm Technologies QDF2432 only
supports full-length 32 bit register accesses, so use those exclusively. This
is compatible with SBSAv3, which explicitly requires UART hardware support 32
(and 16 and sometimes 8) bit accesses.
Tested on Juno, Midway, QDF2432, Seattle, and X-Gene 1.
Tested-by: Mark Langsdorf <mlangsdo@redhat.com>
Tested-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Christopher Covington <cov@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Alexandre Belloni [Tue, 12 Apr 2016 12:51:40 +0000 (14:51 +0200)]
tty/serial: atmel: fix hardware handshake selection
Commit
1cf6e8fc8341 ("tty/serial: at91: fix RTS line management when
hardware handshake is enabled") actually allowed to enable hardware
handshaking.
Before, the CRTSCTS flags was silently ignored.
As the DMA controller can't drive RTS (as explain in the commit message).
Ensure that hardware flow control stays disabled when DMA is used and FIFOs
are not available.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Fixes:
1cf6e8fc8341 ("tty/serial: at91: fix RTS line management when hardware handshake is enabled")
Cc: stable <stable@vger.kernel.org> # v4.0+
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Jiri Slaby [Tue, 22 Mar 2016 17:09:51 +0000 (18:09 +0100)]
TTY: n_gsm, fix false positive WARN_ON
Dmitry reported, that the current cleanup code in n_gsm can trigger a
warning:
WARNING: CPU: 2 PID: 24238 at drivers/tty/n_gsm.c:2048 gsm_cleanup_mux+0x166/0x6b0()
...
Call Trace:
...
[<
ffffffff81247ab9>] warn_slowpath_null+0x29/0x30 kernel/panic.c:490
[<
ffffffff828d0456>] gsm_cleanup_mux+0x166/0x6b0 drivers/tty/n_gsm.c:2048
[<
ffffffff828d4d87>] gsmld_open+0x5b7/0x7a0 drivers/tty/n_gsm.c:2386
[<
ffffffff828b9078>] tty_ldisc_open.isra.2+0x78/0xd0 drivers/tty/tty_ldisc.c:447
[<
ffffffff828b973a>] tty_set_ldisc+0x1ca/0xa70 drivers/tty/tty_ldisc.c:567
[< inline >] tiocsetd drivers/tty/tty_io.c:2650
[<
ffffffff828a14ea>] tty_ioctl+0xb2a/0x2140 drivers/tty/tty_io.c:2883
...
But this is a legal path when open fails to find a space in the
gsm_mux array and tries to clean up. So make it a standard test
instead of a warning.
Reported-by: "Dmitry Vyukov" <dvyukov@google.com>
Cc: Alan Cox <alan@linux.intel.com>
Link: http://lkml.kernel.org/r/CACT4Y+bHQbAB68VFi7Romcs-Z9ZW3kQRvcq+BvHH1oa5NcAdLA@mail.gmail.com
Fixes:
5a640967 ("tty/n_gsm.c: fix a memory leak in gsmld_open()")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
David Müller [Wed, 27 Apr 2016 09:58:32 +0000 (11:58 +0200)]
serial: 8250_pci: fix divide error bug if baud rate is 0
Since commit
21947ba654a6 ("serial: 8250_pci: replace switch-case by
formula"), the 8250 driver crashes in the byt_set_termios() function
with a divide error. This is caused by the fact that a baud rate of 0 (B0)
is not handled properly. Fix it by falling back to B9600 in this case.
Signed-off-by: David Müller <d.mueller@elsoft.ch>
Fixes:
21947ba654a6 ("serial: 8250_pci: replace switch-case by formula")
Cc: stable@vger.kernel.org
Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Linus Torvalds [Sun, 24 Apr 2016 23:17:05 +0000 (16:17 -0700)]
Linux 4.6-rc5
Linus Torvalds [Sun, 24 Apr 2016 00:15:39 +0000 (17:15 -0700)]
Merge branch 'fixes' of git://git./linux/kernel/git/evalenti/linux-soc-thermal
Pull thermal fixes from Eduardo Valentin:
"Specifics in this pull request:
- Fixes in mediatek and OF thermal drivers
- Fixes in power_allocator governor
- More fixes of unsigned to int type change in thermal_core.c.
These change have been CI tested using KernelCI bot. \o/"
* 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal:
thermal: fix Mediatek thermal controller build
thermal: consistently use int for trip temp
thermal: fix mtk_thermal build dependency
thermal: minor mtk_thermal.c cleanups
thermal: power_allocator: req_range multiplication should be a 64 bit type
thermal: of: add __init attribute
Linus Torvalds [Sat, 23 Apr 2016 21:53:11 +0000 (14:53 -0700)]
Merge tag 'asm-generic-4.6' of git://git./linux/kernel/git/arnd/asm-generic
Pull asm-generic update from Arnd Bergmann:
"Here is one patch to wire up the preadv/pwritev system calls in the
generic system call table, which is required for all architectures
that were merged in the last few years, including arm64.
Usually these get merged along with the syscall implementation or one
of the architecture trees, but this time that did not happen.
Andre and Christoph both sent a version of this patch, I picked the
one I got first"
* tag 'asm-generic-4.6' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic:
generic syscalls: wire up preadv2 and pwritev2 syscalls
Andre Przywara [Mon, 11 Apr 2016 09:17:46 +0000 (10:17 +0100)]
generic syscalls: wire up preadv2 and pwritev2 syscalls
These new syscalls are implemented as generic code, so enable them for
architectures like arm64 which use the generic syscall table.
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Linus Torvalds [Sat, 23 Apr 2016 19:07:29 +0000 (12:07 -0700)]
Merge branch 'x86-urgent-for-linus' of git://git./linux/kernel/git/tip/tip
Pull x86 fixes from Ingo Molnar:
"Misc fixes: two EDAC driver fixes, a Xen crash fix, a HyperV log spam
fix and a documentation fix"
* 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
x86 EDAC, sb_edac.c: Take account of channel hashing when needed
x86 EDAC, sb_edac.c: Repair damage introduced when "fixing" channel address
x86/mm/xen: Suppress hugetlbfs in PV guests
x86/doc: Correct limits in Documentation/x86/x86_64/mm.txt
x86/hyperv: Avoid reporting bogus NMI status for Gen2 instances
Linus Torvalds [Sat, 23 Apr 2016 18:45:52 +0000 (11:45 -0700)]
Merge branches 'perf-urgent-for-linus', 'smp-urgent-for-linus' and 'timers-urgent-for-linus' of git://git./linux/kernel/git/tip/tip
Pull perf, cpu hotplug and timer fixes from Ingo Molnar:
"perf:
- A single tooling fix for a user-triggerable segfault.
CPU hotplug:
- Fix a CPU hotplug corner case regression, introduced by the recent
hotplug rework
timers:
- Fix a boot hang in the ARM based Tango SoC clocksource driver"
* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
perf intel-pt: Fix segfault tracing transactions
* 'smp-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
cpu/hotplug: Fix rollback during error-out in __cpu_disable()
* 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
clocksource/drivers/tango-xtal: Fix boot hang due to incorrect test
Linus Torvalds [Sat, 23 Apr 2016 18:39:48 +0000 (11:39 -0700)]
Merge branch 'locking-urgent-for-linus' of git://git./linux/kernel/git/tip/tip
Pull locking fixes from Ingo Molnar:
"Misc fixes:
pvqspinlocks:
- an instrumentation fix
futexes:
- preempt-count vs pagefault_disable decouple corner case fix
- futex requeue plist race window fix
- futex UNLOCK_PI transaction fix for a corner case"
* 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
asm-generic/futex: Re-enable preemption in futex_atomic_cmpxchg_inatomic()
futex: Acknowledge a new waiter in counter before plist
futex: Handle unlock_pi race gracefully
locking/pvqspinlock: Fix division by zero in qstat_read()
Linus Torvalds [Sat, 23 Apr 2016 18:34:39 +0000 (11:34 -0700)]
Merge branch 'irq-urgent-for-linus' of git://git./linux/kernel/git/tip/tip
Pull irq fixes from Ingo Molnar:
"A core irq affinity masks related fix and a MIPS irqchip driver fix"
* 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
irqchip/mips-gic: Don't overrun pcpu_masks array
genirq: Dont allow affinity mask to be updated on IPIs
Linus Torvalds [Sat, 23 Apr 2016 18:25:01 +0000 (11:25 -0700)]
Merge branch 'core-urgent-for-linus' of git://git./linux/kernel/git/tip/tip
Pull objtool fixes from Ingo Molnar:
"A handful of objtool fixes: two improvements to how warnings are
printed plus a false positive warning fix, and build environment fix"
* 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
objtool: Fix Makefile to properly see if libelf is supported
objtool: Detect falling through to the next function
objtool: Add workaround for GCC switch jump table bug
Linus Torvalds [Sat, 23 Apr 2016 18:20:03 +0000 (11:20 -0700)]
Merge tag 'usb-4.6-rc5' of git://git./linux/kernel/git/gregkh/usb
Pull USB / PHY driver fixes from Greg KH:
"Here are two small sets of patches, both from subsystem trees, USB
gadget and PHY drivers.
Full details are in the shortlog, and they have all been in linux-next
for a while (before I merged them to the USB tree)"
* tag 'usb-4.6-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
usb: gadget: f_fs: Fix use-after-free
usb: dwc3: gadget: Fix suspend/resume during device mode
usb: dwc3: fix memory leak of dwc->regset
usb: dwc3: core: fix PHY handling during suspend
usb: dwc3: omap: fix up error path on probe()
usb: gadget: composite: Clear reserved fields of SSP Dev Cap
phy: rockchip-emmc: adapt binding to specifiy register offset and length
phy: rockchip-emmc: should be a child device of the GRF
phy: rockchip-dp: should be a child device of the GRF
Linus Torvalds [Sat, 23 Apr 2016 18:13:46 +0000 (11:13 -0700)]
Merge tag 'tty-4.6-rc5' of git://git./linux/kernel/git/gregkh/tty
Pull serial fixes from Greg KH:
"Here are 3 serial driver fixes for issues that have been reported.
Two are reverts, fixing problems that were in the big TTY/Serial
driver merge in 4.6-rc1, and the last one is a simple bugfix for a
regression that showed up in 4.6-rc1 as well.
All have been in linux-next with no reported issues"
* tag 'tty-4.6-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
Revert "serial: 8250: Add hardware dependency to RT288X option"
tty/serial/8250: fix RS485 half-duplex RX
Revert "serial-uartlite: Constify uartlite_be/uartlite_le"
Linus Torvalds [Sat, 23 Apr 2016 18:04:26 +0000 (11:04 -0700)]
Merge branch 'for-linus' of git://git./linux/kernel/git/dtor/input
Pull input subsystem fixes from Dmitry Torokhov:
"Just minor driver fixes"
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
Input: twl4030-vibra - do not reparent to grandparent
Input: twl6040-vibra - do not reparent to grandparent
Input: twl6040-vibra - ignore return value of schedule_work
Input: twl6040-vibra - fix NULL pointer dereference by removing workqueue
Input: pmic8xxx-pwrkey - fix algorithm for converting trigger delay
Input: arizona-haptic - don't assign input_dev parent
Input: clarify we want BTN_TOOL_<name> on proximity
Input: xpad - add Mad Catz FightStick TE 2 VID/PID
Input: gtco - fix crash on detecting device without endpoints
Linus Torvalds [Fri, 22 Apr 2016 18:52:49 +0000 (11:52 -0700)]
Merge tag 'pinctrl-v4.6-3' of git://git./linux/kernel/git/linusw/linux-pinctrl
Pull pin control fixes from Linus Walleij:
"Some pin control driver fixes came in. One headed for stable and the
other two are just ordinary merge window fixes.
- Make the i.MX driver select REGMAP as a dependency
- Fix up the Mediatek debounce time unit
- Fix a real hairy ffs vs __ffs issue in the Single pinctrl driver"
* tag 'pinctrl-v4.6-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl:
pinctrl: single: Fix pcs_parse_bits_in_pinctrl_entry to use __ffs than ffs
pinctrl: mediatek: correct debounce time unit in mtk_gpio_set_debounce
pinctrl: imx: Kconfig: PINCTRL_IMX select REGMAP
Linus Torvalds [Fri, 22 Apr 2016 18:11:15 +0000 (11:11 -0700)]
Merge tag 'arm64-fixes' of git://git./linux/kernel/git/arm64/linux
Pull arm64 fixes from Catalin Marinas:
- Cache invalidation fix for early CPU boot status update (incorrect
cacheline)
- of_put_node() missing in the spin_table code
- EL1/El2 early init inconsistency when Virtualisation Host Extensions
are present
- RCU warning fix in the arm_pmu.c driver
* tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
arm64: Fix EL1/EL2 early init inconsistencies with VHE
drivers/perf: arm-pmu: fix RCU usage on pmu resume from low-power
arm64: spin-table: add missing of_node_put()
arm64: fix invalidation of wrong __early_cpu_boot_status cacheline
Linus Torvalds [Fri, 22 Apr 2016 17:53:12 +0000 (10:53 -0700)]
Merge tag 'powerpc-4.6-3' of git://git./linux/kernel/git/powerpc/linux
Pull powerpc fixes from Michael Ellerman:
"Three powerpc cpu feature fixes from Anton Blanchard:
- scan_features() updated incorrect bits for REAL_LE
- update cpu_user_features2 in scan_features()
- update TM user feature bits in scan_features()"
* tag 'powerpc-4.6-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
powerpc: Update TM user feature bits in scan_features()
powerpc: Update cpu_user_features2 in scan_features()
powerpc: scan_features() updates incorrect bits for REAL_LE