aboutsummaryrefslogtreecommitdiff
path: root/drivers/tty
AgeCommit message (Collapse)AuthorFilesLines
2013-12-17serial: pl011: fix fall back from DMA to interrupt modeGuennadi Liakhovetski1-0/+2
When falling back from DMA to interrupt mode the receive interrupt has to be re-enabled to catch new incoming data. Signed-off-by: Guennadi Liakhovetski <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-12-17serial: pl011: (cosmetic) remove superfluous register writeGuennadi Liakhovetski1-3/+1
In pl011_rx_chars() if pl011_dma_rx_trigger_dma() succeeds it will disable the receive interrupt, no need to do this again. Signed-off-by: Guennadi Liakhovetski <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-12-17serial: amba-pl011: preseserve hardware settings during initialisationJon Medhurst1-2/+12
During initialisation, a UART may already be in use for a console, so take care to preserve things like baud rate and data format to avoid corrupting console output. Signed-off-by: Jon Medhurst <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-12-17serial: amba-pl011: factor out code for writing LCR_H registerJon Medhurst1-22/+17
The code to cope with a split tx/rx LCR_H register is non-trivial so put it into it's own function to avoid duplication. Signed-off-by: Jon Medhurst <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-12-17serial: amba-pl011: use port lock to guard control register accessJon Medhurst1-0/+6
When the pl011 is being used for a console, pl011_console_write forces the control register (CR) to enable the UART for transmission and then restores this to the original value afterwards. It does this while holding the port lock. Unfortunately, when the uart is started or shutdown - say in response to userland using the serial device for a terminal - then this updates the control register without any locking. This means we can have pl011_console_write Save CR pl011_startup Initialise CR, e.g. enable receive pl011_console_write Restore old CR with receive not enabled this result is a serial port which doesn't respond to any input. A similar race in reverse could happen when the device is shutdown. We can fix these problems by taking the port lock when updating CR. Signed-off-by: Jon Medhurst <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-12-17Revert "serial: pl011: use DMA RX polling by default"Greg Kroah-Hartman1-1/+1
This reverts commit 17438217a6f5e33d920ed3821a4b857311cc2872 on request of Linus Walleij: Greg can you please drop or revert commit 17438217a6f5e33d920ed3821a4b857311cc2872 "serial: pl011: use DMA RX polling by default" from the TTY tree until this has been sorted out? Cc: Linus Walleij <[email protected]> Cc: Guennadi Liakhovetski <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-12-17n_tty: Fix buffer overruns with larger-than-4k pastesPeter Hurley1-3/+23
readline() inadvertently triggers an error recovery path when pastes larger than 4k overrun the line discipline buffer. The error recovery path discards input when the line discipline buffer is full and operating in canonical mode and no newline has been received. Because readline() changes the termios to non-canonical mode to read the line char-by-char, the line discipline buffer can become full, and then when readline() restores termios back to canonical mode for the caller, the now-full line discipline buffer triggers the error recovery. When changing termios from non-canon to canon mode and the read buffer contains data, simulate an EOF push _without_ the DISABLED_CHAR in the read buffer. Importantly for the readline() problem, the termios can be changed back to non-canonical mode without changes to the read buffer occurring; ie., as if the previous termios change had not happened (as long as no intervening read took place). Preserve existing userspace behavior which allows '\0's already received in non-canon mode to be read as '\0's in canon mode (rather than trigger add'l EOF pushes or an actual EOF). Patch based on original proposal and discussion here https://bugzilla.kernel.org/show_bug.cgi?id=55991 by Stas Sergeev <[email protected]> Reported-by: Margarita Manterola <[email protected]> Cc: Maximiliano Curia <[email protected]> Cc: Pavel Machek <[email protected]> Cc: Arkadiusz Miskiewicz <[email protected]> Acked-by: Stas Sergeev <[email protected]> Signed-off-by: Peter Hurley <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-12-17serial: clps711x: Driver refactorAlexander Shiyan1-194/+254
This is a complex patch for refactoring CLPS711X serial driver. Major changes: - Eliminate <mach/hardware.h> usage. - Devicetree support. Signed-off-by: Alexander Shiyan <[email protected]> Acked-by: Arnd Bergmann <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-12-16serial: 8250_dw: Fix LCR workaround regressionJames Hogan1-2/+4
Commit c49436b657d0 (serial: 8250_dw: Improve unwritable LCR workaround) caused a regression. It added a check that the LCR was written properly to detect and workaround the busy quirk, but the behaviour of bit 5 (UART_LCR_SPAR) differs between IP versions 3.00a and 3.14c per the docs. On older versions this caused the check to fail and it would repeatedly force idle and rewrite the LCR register, causing delays and preventing any input from serial being received. This is fixed by masking out UART_LCR_SPAR before making the comparison. Signed-off-by: James Hogan <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Jiri Slaby <[email protected]> Cc: Tim Kryger <[email protected]> Cc: Ezequiel Garcia <[email protected]> Cc: Matt Porter <[email protected]> Cc: Markus Mayer <[email protected]> Tested-by: Tim Kryger <[email protected]> Tested-by: Ezequiel Garcia <[email protected]> Tested-by: Heikki Krogerus <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-12-16tty: Fix hang at ldsem_down_read()Peter Hurley1-3/+13
When a controlling tty is being hung up and the hang up is waiting for a just-signalled tty reader or writer to exit, and a new tty reader/writer tries to acquire an ldisc reference concurrently with the ldisc reference release from the signalled reader/writer, the hangup can hang. The new reader/writer is sleeping in ldsem_down_read() and the hangup is sleeping in ldsem_down_write() [1]. The new reader/writer fails to wakeup the waiting hangup because the wrong lock count value is checked (the old lock count rather than the new lock count) to see if the lock is unowned. Change helper function to return the new lock count if the cmpxchg was successful; document this behavior. [1] edited dmesg log from reporter SysRq : Show Blocked State task PC stack pid father systemd D ffff88040c4f0000 0 1 0 0x00000000 ffff88040c49fbe0 0000000000000046 ffff88040c4a0000 ffff88040c49ffd8 00000000001d3980 00000000001d3980 ffff88040c4a0000 ffff88040593d840 ffff88040c49fb40 ffffffff810a4cc0 0000000000000006 0000000000000023 Call Trace: [<ffffffff810a4cc0>] ? sched_clock_cpu+0x9f/0xe4 [<ffffffff810a4cc0>] ? sched_clock_cpu+0x9f/0xe4 [<ffffffff810a4cc0>] ? sched_clock_cpu+0x9f/0xe4 [<ffffffff810a4cc0>] ? sched_clock_cpu+0x9f/0xe4 [<ffffffff817a6649>] schedule+0x24/0x5e [<ffffffff817a588b>] schedule_timeout+0x15b/0x1ec [<ffffffff810a4cc0>] ? sched_clock_cpu+0x9f/0xe4 [<ffffffff817aa691>] ? _raw_spin_unlock_irq+0x24/0x26 [<ffffffff817aa10c>] down_read_failed+0xe3/0x1b9 [<ffffffff817aa26d>] ldsem_down_read+0x8b/0xa5 [<ffffffff8142b5ca>] ? tty_ldisc_ref_wait+0x1b/0x44 [<ffffffff8142b5ca>] tty_ldisc_ref_wait+0x1b/0x44 [<ffffffff81423f5b>] tty_write+0x7d/0x28a [<ffffffff814241f5>] redirected_tty_write+0x8d/0x98 [<ffffffff81424168>] ? tty_write+0x28a/0x28a [<ffffffff8115d03f>] do_loop_readv_writev+0x56/0x79 [<ffffffff8115e604>] do_readv_writev+0x1b0/0x1ff [<ffffffff8116ea0b>] ? do_vfs_ioctl+0x32a/0x489 [<ffffffff81167d9d>] ? final_putname+0x1d/0x3a [<ffffffff8115e6c7>] vfs_writev+0x2e/0x49 [<ffffffff8115e7d3>] SyS_writev+0x47/0xaa [<ffffffff817ab822>] system_call_fastpath+0x16/0x1b bash D ffffffff81c104c0 0 5469 5302 0x00000082 ffff8800cf817ac0 0000000000000046 ffff8804086b22a0 ffff8800cf817fd8 00000000001d3980 00000000001d3980 ffff8804086b22a0 ffff8800cf817a48 000000000000b9a0 ffff8800cf817a78 ffffffff81004675 ffff8800cf817a44 Call Trace: [<ffffffff81004675>] ? dump_trace+0x165/0x29c [<ffffffff810a4cc0>] ? sched_clock_cpu+0x9f/0xe4 [<ffffffff8100edda>] ? save_stack_trace+0x26/0x41 [<ffffffff817a6649>] schedule+0x24/0x5e [<ffffffff817a588b>] schedule_timeout+0x15b/0x1ec [<ffffffff810a4cc0>] ? sched_clock_cpu+0x9f/0xe4 [<ffffffff817a9f03>] ? down_write_failed+0xa3/0x1c9 [<ffffffff817aa691>] ? _raw_spin_unlock_irq+0x24/0x26 [<ffffffff817a9f0b>] down_write_failed+0xab/0x1c9 [<ffffffff817aa300>] ldsem_down_write+0x79/0xb1 [<ffffffff817aada3>] ? tty_ldisc_lock_pair_timeout+0xa5/0xd9 [<ffffffff817aada3>] tty_ldisc_lock_pair_timeout+0xa5/0xd9 [<ffffffff8142bf33>] tty_ldisc_hangup+0xc4/0x218 [<ffffffff81423ab3>] __tty_hangup+0x2e2/0x3ed [<ffffffff81424a76>] disassociate_ctty+0x63/0x226 [<ffffffff81078aa7>] do_exit+0x79f/0xa11 [<ffffffff81086bdb>] ? get_signal_to_deliver+0x206/0x62f [<ffffffff810b4bfb>] ? lock_release_holdtime.part.8+0xf/0x16e [<ffffffff81079b05>] do_group_exit+0x47/0xb5 [<ffffffff81086c16>] get_signal_to_deliver+0x241/0x62f [<ffffffff810020a7>] do_signal+0x43/0x59d [<ffffffff810f2af7>] ? __audit_syscall_exit+0x21a/0x2a8 [<ffffffff810b4bfb>] ? lock_release_holdtime.part.8+0xf/0x16e [<ffffffff81002655>] do_notify_resume+0x54/0x6c [<ffffffff817abaf8>] int_signal+0x12/0x17 Reported-by: Sami Farin <[email protected]> Cc: <[email protected]> # 3.12.x Signed-off-by: Peter Hurley <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-12-16Merge 3.13-rc4 into tty-nextGreg Kroah-Hartman1-2/+4
We want the fixes in here as well.
2013-12-14serial: sh-sci: Convert to clk_prepare/unprepareLaurent Pinchart1-4/+4
Turn clk_enable() and clk_disable() calls into clk_prepare_enable() and clk_disable_unprepare() to get ready for the migration to the common clock framework. Signed-off-by: Laurent Pinchart <[email protected]> Acked-by: Magnus Damm <[email protected]> Acked-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Simon Horman <[email protected]>
2013-12-14serial: sh-sci: Don't enable/disable port from within break timerLaurent Pinchart1-4/+8
The break timer accesses hardware registers and thus requires the port to be enabled. It currently ensures this by enabling the port at the beginning of the timer handler, and disabling it at the end. However, the enable/disable operations call the runtime PM sync functions, which are not allowed in atomic context. The current situation is thus broken. This change relies on non-atomic code to enable/disable the port. The break timer will only be started from the IRQ handler, which already runs with the port enabled. We just need to ensure that the port won't be disabled with the timer running, and that's easily done by just cancelling the timer in the port disable function. Signed-off-by: Laurent Pinchart <[email protected]> Acked-by: Magnus Damm <[email protected]> Acked-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Simon Horman <[email protected]>
2013-12-12serial: sh-sci: Fix warnings due to improper casts and printk formatsLaurent Pinchart1-9/+10
Use the %zu and %pad printk specifiers to print size_t and dma_addr_t variables, and cast pointers to uintptr_t instead of unsigned int where applicable. This fixes warnings on platforms where pointers and/or dma_addr_t have a different size than int. Cc: [email protected] Signed-off-by: Laurent Pinchart <[email protected]> Acked-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Simon Horman <[email protected]>
2013-12-11serial: tegra: convert to standard DMA DT bindingsStephen Warren1-18/+6
By using dma_request_slave_channel_or_err(), the DMA slave ID can be looked up from standard DT properties, and squirrelled away during channel allocation. Hence, there's no need to use a custom DT property to store the slave ID. Acked-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Stephen Warren <[email protected]> Reviewed-by: Thierry Reding <[email protected]>
2013-12-11serial: tegra: use reset frameworkStephen Warren1-4/+10
Tegra's clock driver now provides an implementation of the common reset API (include/linux/reset.h). Use this instead of the old Tegra- specific API; that will soon be removed. Signed-off-by: Stephen Warren <[email protected]> Acked-by: Greg Kroah-Hartman <[email protected]> Reviewed-by: Thierry Reding <[email protected]>
2013-12-09tty: Halve flip buffer GFP_ATOMIC memory consumptionPeter Hurley1-10/+35
tty flip buffers use GFP_ATOMIC allocations for received data which is to be processed by the line discipline. For each byte received, an extra byte is used to indicate the error status of that byte. Instead, if the received data is error-free, encode the entire buffer without status bytes. Signed-off-by: Peter Hurley <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-12-08tty: xuartps: Properly guard sysrq specific codeSoren Brinkmann1-0/+2
Commit 'tty: xuartps: Implement BREAK detection, add SYSRQ support' (0c0c47bc40a2e358d593b2d7fb93b50027fbfc0c) introduced sysrq support without properly guarding sysrq specific code which results in build errors when sysrq is disabled: DNAME=KBUILD_STR(xilinx_uartps)" -c -o drivers/tty/serial/.tmp_xilinx_uartps.o drivers/tty/serial/xilinx_uartps.c drivers/tty/serial/xilinx_uartps.c: In function 'xuartps_isr': drivers/tty/serial/xilinx_uartps.c:247:5: error: 'struct uart_port' has no member named 'sysrq' drivers/tty/serial/xilinx_uartps.c:247:5: error: 'struct uart_port' has no member named 'sysrq' drivers/tty/serial/xilinx_uartps.c:247:5: error: 'struct uart_port' has no member named 'sysrq' make[3]: *** [drivers/tty/serial/xilinx_uartps.o] Error 1 Reported-by: Masanari Iida <[email protected]> Cc: Vlad Lungu <[email protected]> Signed-off-by: Soren Brinkmann <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-12-08serial: 8250: Fix initialisation of Quatech cards with the AMCC PCI chipJonathan Woithe1-2/+2
Fix the initialisation of older Quatech serial cards which are fitted with the AMCC PCI Matchmaker interface chip. Signed-off-by: Jonathan Woithe ([email protected]) Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-12-08serial: icom: dereference after free in load_code()Dan Carpenter1-2/+2
We use "fw" in the next line after we release it. I've shifted the call to release_firmware() down a couple lines to fix this. Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-12-08serial: 8250_dw: add new ACPI IDsMika Westerberg1-0/+2
Newer Intel PCHs with LPSS have the same Designware controllers than Haswell but ACPI IDs are different. Add these IDs to the driver list. Signed-off-by: Mika Westerberg <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-12-08tty: serial: pch: don't crash if DMA enabled but not loadedSebastian Andrzej Siewior1-3/+7
if the DMA driver isn't loaded "on time" then we crash in the irq handler: | pch_uart 0000:02:0a.4: pch_request_dma:dma_request_channel FAILS(Tx) | BUG: unable to handle kernel NULL pointer dereference at (null) | IP: [<c0676ed9>] pch_uart_interrupt+0x739/0x940 Signed-off-by: Sebastian Andrzej Siewior <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-12-08serial: samsung: move clock deactivation below uart registrationHeiko Stübner1-1/+7
Commit 60e93575476f (serial: samsung: enable clock before clearing pending interrupts during init) added handling of the controller clock during init. On most systems this clock is also one of the baud_clock sources and possibly used by the earlycon and thus already enabled by the bootloader. Therefore a gap exists between s3c24xx_serial_init_port disabling the clock and an attached console reenabling it, making the transition from earlycon to regular console possibly hang the system - as seen on my S3C2442 based Freerunner today. Therefore move the disabling of the clock from s3c24xx_serial_init_port below the uart port registration, effectively creating an overlap and keeping the clock running non-stop if the console wants to grab this port. Signed-off-by: Heiko Stuebner <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-12-08tty: serial: mxs-auart: Check the return value from clk_prepare_enable()Fabio Estevam1-2/+7
clk_prepare_enable() may fail, so let's check its return value and propagate it in the case of error. Signed-off-by: Fabio Estevam <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-12-08tty: Fix stale tty_buffer_flush() commentPeter Hurley1-3/+1
Commit d7a68be4f265be10e24be931c257af30ca55566b, 'tty: Only perform flip buffer flush from tty_buffer_flush()', removed buffer flushing from flush_to_ldisc(). Fix function header comment which describes the former behavior. Signed-off-by: Peter Hurley <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-12-08serial: pl010: Convert to modern PM opsUlf Hansson1-6/+9
Convert to modern PM ops and use the SIMPLE_DEV_PM_OPS macro to set up the PM callbacks. Cc: Greg Kroah-Hartman <[email protected]> Signed-off-by: Ulf Hansson <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-12-08tty: remove DEFINE_PCI_DEVICE_TABLE macroJingoo Han3-3/+3
Don't use DEFINE_PCI_DEVICE_TABLE macro, because this macro is not preferred. Signed-off-by: Jingoo Han <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-12-08serial: imx: add support for loopback mode.Huang Shijie1-0/+8
Add the loopback mode support for imx uart driver. Signed-off-by: Huang Shijie <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-12-08serial: pl011: use DMA RX polling by defaultLinus Walleij1-1/+1
Making DMA RX polling optional when DMA is on was just over-cautious: there is one single system in the kernel tree using this facility, Ux500 and after some testing I turned this on also for Ux500, which means it should simply be on by default if DMA is enabled. Cc: Jongsung Kim <[email protected]> Cc: Chanho Min <[email protected]> Cc: Russell King <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-12-08serial: pl011: Convert to modern PM opsUlf Hansson1-9/+8
Convert to modern PM ops and use the SIMPLE_DEV_PM_OPS macro to set up the PM callbacks. Cc: Greg Kroah-Hartman <[email protected]> Signed-off-by: Ulf Hansson <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-12-08n_gsm: race between ld close and gsmtty openChao Bi1-10/+29
ttyA has ld associated to n_gsm, when ttyA is closing, it triggers to release gsmttyB's ld data dlci[B], then race would happen if gsmttyB is opening in parallel. (Note: This patch set differs from previous set in that it uses mutex instead of spin lock to avoid race, so that it avoids sleeping in automic context) Here are race cases we found recently in test: CASE #1 ==================================================================== releasing dlci[B] race with gsmtty_install(gsmttyB), then panic in gsmtty_open(gsmttyB), as below: tty_release(ttyA) tty_open(gsmttyB) | | ----- gsmtty_install(gsmttyB) | | ----- gsm_dlci_alloc(gsmttyB) => alloc dlci[B] tty_ldisc_release(ttyA) ----- | | gsm_dlci_release(dlci[B]) ----- | | gsm_dlci_free(dlci[B]) ----- | | ----- gsmtty_open(gsmttyB) gsmtty_open() { struct gsm_dlci *dlci = tty->driver_data; => here it uses dlci[B] ... } In gsmtty_open(gsmttyA), it uses dlci[B] which was release, so hit a panic. ===================================================================== CASE #2 ===================================================================== releasing dlci[0] race with gsmtty_install(gsmttyB), then panic in gsmtty_open(), as below: tty_release(ttyA) tty_open(gsmttyB) | | ----- gsmtty_install(gsmttyB) | | ----- gsm_dlci_alloc(gsmttyB) => alloc dlci[B] | | ----- gsmtty_open(gsmttyB) fail | | ----- tty_release(gsmttyB) | | ----- gsmtty_close(gsmttyB) | | ----- gsmtty_detach_dlci(dlci[B]) | | ----- dlci_put(dlci[B]) | | tty_ldisc_release(ttyA) ----- | | gsm_dlci_release(dlci[0]) ----- | | gsm_dlci_free(dlci[0]) ----- | | ----- dlci_put(dlci[0]) In gsmtty_detach_dlci(dlci[B]), it tries to use dlci[0] which was released, then hit panic. ===================================================================== IMHO, n_gsm tty operations would refer released ldisc, as long as gsm_dlci_release() has chance to release ldisc data when some gsmtty operations are ongoing.. This patch is try to avoid it by: 1) in n_gsm driver, use a global gsm mutex lock to avoid gsm_dlci_release() run in parallel with gsmtty_install(); 2) Increase dlci's ref count in gsmtty_install() instead of in gsmtty_open(), the purpose is to prevent gsm_dlci_release() releasing dlci after gsmtty_install() allocats dlci but before gsmtty_open increases dlci's ref count; 3) Decrease dlci's ref count in gsmtty_remove(), a tty framework API, this is the opposite process of step 2). Signed-off-by: Chao Bi <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-12-08serial: pch_uart: remove unnecessary pci_set_drvdata()Jingoo Han1-1/+0
The driver core clears the driver data to NULL after device_release or on probe failure. Thus, it is not needed to manually clear the device driver data to NULL. Signed-off-by: Jingoo Han <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-12-08staging/fwserial: Rip out rx bufferingPeter Hurley1-0/+1
Signed-off-by: Peter Hurley <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-12-08tty: Remove tty_prepare_flip_string_flags()Peter Hurley1-28/+0
There is no in-tree user of tty_prepare_flip_string_flags(); remove. Signed-off-by: Peter Hurley <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-12-08tty: Rename tty buffer memory_used fieldPeter Hurley1-6/+6
Trim up the memory_used field name to mem_used. Signed-off-by: Peter Hurley <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-12-08tty: Enable configurable tty flip buffer limitPeter Hurley1-3/+21
Allow driver to configure its maximum flip buffer memory consumption/limit. This is necessary for very-high speed line rates (in excess of 10MB/sec) because the flip buffers can be saturated before the line discipline has a chance to throttle the input. Signed-off-by: Peter Hurley <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-12-08tty: Always handle NULL flag ptrPeter Hurley2-3/+4
Most line disciplines already handle the undocumented NULL flag ptr in their .receive_buf method; however, several don't. Document the NULL flag ptr, and correct handling in the N_MOUSE, N_GSM0710 and N_R394 line disciplines. Signed-off-by: Peter Hurley <[email protected]> Acked-by: Dmitry Torokhov <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-12-08n_tty: Only perform wakeups for waitersPeter Hurley1-6/+12
Only wakeup the _waiting_ reader, polls and/or writer(s). Signed-off-by: Peter Hurley <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-12-08n_tty: Refactor input_available_p() by call sitePeter Hurley1-3/+4
Distinguish if caller is n_tty_poll() or n_tty_read(), and set the read/wakeup threshold accordingly. Signed-off-by: Peter Hurley <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-12-08n_tty: Refactor PARMRK doubling checksPeter Hurley1-9/+5
Perform PARMRK doubling checks explicitly; remove ternary idiom and local variable. Signed-off-by: Peter Hurley <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-12-08n_tty: Un-inline slow-path n_tty_receive_char_closing()Peter Hurley1-2/+1
Although n_tty_receive_char_closing() only has one call-site, let the compiler inline instead. Signed-off-by: Peter Hurley <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-12-08n_tty: Un-inline slow-path n_tty_receive_char()Peter Hurley1-1/+1
Commit e60d27c4d8b33ba20896b76b6558f061bc6460ff, n_tty: Factor LNEXT processing from per-char i/o path, mistakenly inlined the non-inline alias, n_tty_receive_char(), for the inline function, n_tty_receive_char_inline(). As n_tty_receive_char() is intended for slow-path char processing only, un-inline it. Signed-off-by: Peter Hurley <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-12-08n_tty: Merge .receive_buf() flavorsPeter Hurley1-27/+16
N_TTY's direct and flow-controlled flavors of the .receive_buf() method are nearly identical; fold together. Signed-off-by: Peter Hurley <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-12-08serial: pl011: remove redundant early amba_ports declarationBaruch Siach1-2/+0
This early amba_ports declaration was introduced by commit c16d51a32 (amba pl011: workaround for uart registers lockup) for use in the pl011_lockup_wa() routine. This routine was later removed by commit 4fd0690bb (serial: pl011: implement workaround for CTS clear event issue). Signed-off-by: Baruch Siach <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-12-08serial: 8250_dw: remove ACPI ifdefHeikki Krogerus1-8/+0
ACPI now provides stubs for the functions the driver uses. Signed-off-by: Heikki Krogerus <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-12-08serial_core: Don't re-initialize a previously initialized spinlock.Randy Witt1-2/+6
The uart_set_options() code unconditionally initalizes the spinlock on the port. This can cause a deadlock in some situations. One instance that exposed the problem, was when writing to /sys/module/kgdboc/parameters/kgdboc to use ttyS0 when the console is already running on ttyS0. If the spinlock is re-initialized while the lock is held due to output to the console, there is a deadlock. Assume the spinlock is initialized if the port is a console. Signed-off-by: Randy Witt <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-11-29n_tty: Fix missing newline echoPeter Hurley1-2/+4
When L_ECHONL is on, newlines are echoed regardless of the L_ECHO state; if set, ensure accumulated echoes are flushed before finishing the current input processing and before more output. Cc: <[email protected]> # 3.12.x Reported-by: Jason Gunthorpe <[email protected] Tested-by: Jason Gunthorpe <[email protected]> Signed-off-by: Peter Hurley <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-11-25Revert "n_gsm: race between ld close and gsmtty open"Greg Kroah-Hartman1-27/+10
This reverts commit c284ee2cf12b55fa8496b2d098bf0938688f1c1c. Turns out the locking was incorrect. Reported-by: Fengguang Wu <[email protected]> Cc: Chao Bi <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-11-25n_tty: Protect minimum_to_wake reset for concurrent readersPeter Hurley1-2/+2
With multiple, concurrent readers (each waiting to acquire the atomic_read_lock mutex), a departing reader may mistakenly reset minimum_to_wake after a new reader has already set a new value. Protect the minimum_to_wake reset with the atomic_read_lock critical section. Signed-off-by: Peter Hurley <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-11-25tty: Reset hupped state on openPeter Hurley1-0/+1
A common security idiom is to hangup the current tty (via vhangup()) after forking but before execing a root shell. This hangs up any existing opens which other processes may have and ensures subsequent opens have the necessary permissions to open the root shell tty/pty. Reset the TTY_HUPPED state after the driver has successfully returned the opened tty (perform the reset while the tty is locked to avoid racing with concurrent hangups). Reported-by: Heorhi Valakhanovich <[email protected]> Signed-off-by: Peter Hurley <[email protected]> Cc: stable <[email protected]> # 3.12 Tested-by: Heorhi Valakhanovich <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>