aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty (follow)
AgeCommit message (Collapse)AuthorFilesLines
2017-10-13tty: fall back to N_NULL if switching to N_TTY fails during hangupJohannes Weiner1-6/+5
We have seen NULL-pointer dereference crashes in tty->disc_data when the N_TTY fallback driver failed to open during hangup. The immediate cause of this open to fail has been addressed in the preceding patch to vmalloc(), but this code could be more robust. As Alan pointed out in commit 8a8dabf2dd68 ("tty: handle the case where we cannot restore a line discipline"), the N_TTY driver, historically the safe fallback that could never fail, can indeed fail, but the surrounding code is not prepared to handle this. To avoid crashes he added a new N_NULL driver to take N_TTY's place as the last resort. Hook that fallback up to the hangup path. Update tty_ldisc_reinit() to reflect the reality that n_tty_open can indeed fail. Link: http://lkml.kernel.org/r/20171004185959.GC2136@cmpxchg.org Signed-off-by: Johannes Weiner <hannes@cmpxchg.org> Cc: Alan Cox <alan@llwyncelyn.cymru> Cc: Christoph Hellwig <hch@lst.de> Cc: Dmitry Vyukov <dvyukov@google.com> Cc: Michal Hocko <mhocko@suse.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-09-18serial: sccnxp: Fix error handling in sccnxp_probe()Alexey Khoroshilov1-2/+11
sccnxp_probe() returns result of regulator_disable() that may lead to returning zero, while device is not properly initialized. Also the driver enables clocks, but it does not disable it. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-09-18tty: serial: lpuart: avoid report NULL interruptFugang Duan1-23/+17
The current driver register irq in .startup() and free the irq in .shutdown(), then user will see the NULL interrupt output from 'cat /proc/interrupts' after the uart port test completed: ... 41: 515 0 0 0 GICv3 257 Level fsl-lpuart 42: 2 0 0 0 GICv3 258 Level ... It is better to register all the irqs during probe function via devm_request_irq() to avoid to call free_irq(). Signed-off-by: Fugang Duan <fugang.duan@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-09-18serial: bcm63xx: fix timing issue.Russell Enderby1-0/+5
Issue where unprintable characters can occur or output is cut off over the serial uart / linux console depending on timing. Problem occurs when changing the serial baud rate when setting up the new console.The bcm63xx driver does a disable and flush of the uart tx fifo while there is data still in the tx fifo. If the tx fifo still has data it is trying to send out, we need to wait until it is empty before disabling and flushing the uart. When we now go to change the uart parameters including speed we check if there is data currently in the tx fifo.If there is was mdelay(10) and check again.If it tries 3 times and still has data in it we just continue and sacrifice the tx fifo buffer. A cleaner and more preferred approach would be to remove : - spin_lock_irqsave() - bcm_uart_disable() - bcm_uart_flush() However it is not clear if the author put those in to fix another underlying issue.As a result this solution is a safer approach. Output before the fix: [0.306000] 14e00520.serial: ttyS0 at MMIO 0x14e00520 (irq = 9, base_baud = 1687500) is a° 0.315000] console[ttyS0] enabled Output verified after the fix: [0.315000] 14e00520.serial: ttyS0 at MMIO 0x14e00520 (irq = 9, base_baud = 1687500) is a bcm63xx_uart [0.334000] console[ttyS0] enabled Signed-off-by: Russell Enderby <rte@gdn.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-09-18mxser: fix timeout calculation for low ratesJiri Slaby1-5/+11
Paul reported, that low rates like B300 make the driver to hang in mxser_wait_until_sent. His debugging tackled the issue down to the info->timeout computation in mxser_set_baud. Obviously, ints are used there and they easily overflow with these low rates: B300 makes info->timeout to be -373. So switch all these types to unsigned as it ought to be. And use the u64 domain to perform the computation as in the worst case, we need 35 bits to store the computed value (before division). And use do_div not to break 32 bit kernels. [v2] make it actually build Signed-off-by: Jiri Slaby <jslaby@suse.cz> Cc: Paul <Paul@abelian.netcom.co.uk> Tested-by: <Paul@abelian.netcom.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-09-14dmi: Mark all struct dmi_system_id instances constChristoph Hellwig1-1/+1
... and __initconst if applicable. Based on similar work for an older kernel in the Grsecurity patch. [JD: fix toshiba-wmi build] [JD: add htcpen] [JD: move __initconst where checkscript wants it] Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jean Delvare <jdelvare@suse.de>
2017-09-10Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-nextLinus Torvalds3-0/+1161
Pull sparc updates from David Miller: 1) Use register window state adjustment instructions when available, from Anthony Yznaga. 2) Add VCC console concentrator driver, from Jag Raman. 3) Add 16GB hugepage support, from Nitin Gupta. 4) Support cpu 'poke' hypercall, from Vijay Kumar. 5) Add M7/M8 optimized memcpy/memset/copy_{to,from}_user, from Babu Moger. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-next: (33 commits) sparc64: Handle additional cases of no fault loads sparc64: speed up etrap/rtrap on NG2 and later processors sparc64: vcc: make ktermios const sparc: leon: grpci1: constify of_device_id sparc: leon: grpci2: constify of_device_id sparc64: vcc: Check for IS_ERR() instead of NULL sparc64: Cleanup hugepage table walk functions sparc64: Add 16GB hugepage support sparc64: Support huge PUD case in get_user_pages sparc64: vcc: Add install & cleanup TTY operations sparc64: vcc: Add break_ctl TTY operation sparc64: vcc: Add chars_in_buffer TTY operation sparc64: vcc: Add write & write_room TTY operations sparc64: vcc: Add hangup TTY operation sparc64: vcc: Add open & close TTY operations sparc64: vcc: Enable LDC event processing engine sparc64: vcc: Add RX & TX timer for delayed LDC operation sparc64: vcc: Create sysfs attribute group sparc64: vcc: Enable VCC port probe and removal sparc64: vcc: TTY driver initialization and cleanup ...
2017-09-07Merge tag 'powerpc-4.14-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linuxLinus Torvalds1-0/+12
Pull powerpc updates from Michael Ellerman: "Nothing really major this release, despite quite a lot of activity. Just lots of things all over the place. Some things of note include: - Access via perf to a new type of PMU (IMC) on Power9, which can count both core events as well as nest unit events (Memory controller etc). - Optimisations to the radix MMU TLB flushing, mostly to avoid unnecessary Page Walk Cache (PWC) flushes when the structure of the tree is not changing. - Reworks/cleanups of do_page_fault() to modernise it and bring it closer to other architectures where possible. - Rework of our page table walking so that THP updates only need to send IPIs to CPUs where the affected mm has run, rather than all CPUs. - The size of our vmalloc area is increased to 56T on 64-bit hash MMU systems. This avoids problems with the percpu allocator on systems with very sparse NUMA layouts. - STRICT_KERNEL_RWX support on PPC32. - A new sched domain topology for Power9, to capture the fact that pairs of cores may share an L2 cache. - Power9 support for VAS, which is a new mechanism for accessing coprocessors, and initial support for using it with the NX compression accelerator. - Major work on the instruction emulation support, adding support for many new instructions, and reworking it so it can be used to implement the emulation needed to fixup alignment faults. - Support for guests under PowerVM to use the Power9 XIVE interrupt controller. And probably that many things again that are almost as interesting, but I had to keep the list short. Plus the usual fixes and cleanups as always. Thanks to: Alexey Kardashevskiy, Alistair Popple, Andreas Schwab, Aneesh Kumar K.V, Anju T Sudhakar, Arvind Yadav, Balbir Singh, Benjamin Herrenschmidt, Bhumika Goyal, Breno Leitao, Bryant G. Ly, Christophe Leroy, Cédric Le Goater, Dan Carpenter, Dou Liyang, Frederic Barrat, Gautham R. Shenoy, Geliang Tang, Geoff Levand, Hannes Reinecke, Haren Myneni, Ivan Mikhaylov, John Allen, Julia Lawall, LABBE Corentin, Laurentiu Tudor, Madhavan Srinivasan, Markus Elfring, Masahiro Yamada, Matt Brown, Michael Neuling, Murilo Opsfelder Araujo, Nathan Fontenot, Naveen N. Rao, Nicholas Piggin, Oliver O'Halloran, Paul Mackerras, Rashmica Gupta, Rob Herring, Rui Teng, Sam Bobroff, Santosh Sivaraj, Scott Wood, Shilpasri G Bhat, Sukadev Bhattiprolu, Suraj Jitindar Singh, Tobin C. Harding, Victor Aoqui" * tag 'powerpc-4.14-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: (321 commits) powerpc/xive: Fix section __init warning powerpc: Fix kernel crash in emulation of vector loads and stores powerpc/xive: improve debugging macros powerpc/xive: add XIVE Exploitation Mode to CAS powerpc/xive: introduce H_INT_ESB hcall powerpc/xive: add the HW IRQ number under xive_irq_data powerpc/xive: introduce xive_esb_write() powerpc/xive: rename xive_poke_esb() in xive_esb_read() powerpc/xive: guest exploitation of the XIVE interrupt controller powerpc/xive: introduce a common routine xive_queue_page_alloc() powerpc/sstep: Avoid used uninitialized error axonram: Return directly after a failed kzalloc() in axon_ram_probe() axonram: Improve a size determination in axon_ram_probe() axonram: Delete an error message for a failed memory allocation in axon_ram_probe() powerpc/powernv/npu: Move tlb flush before launching ATSD powerpc/macintosh: constify wf_sensor_ops structures powerpc/iommu: Use permission-specific DEVICE_ATTR variants powerpc/eeh: Delete an error out of memory message at init time powerpc/mm: Use seq_putc() in two functions macintosh: Convert to using %pOF instead of full_name ...
2017-09-05Merge tag 'staging-4.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/stagingLinus Torvalds1-7/+96
Pull staging/IIO driver updates from Greg KH: "Here is the big staging and IIO driver update for 4.14-rc1. Lots of staging driver fixes and cleanups, including some reorginizing of the lustre header files to try to impose some sanity on what is, and what is not, the uapi for that filesystem. There are some tty core changes in here as well, as the speakup drivers need them, and that's ok with me, they are sane and the speakup code is getting nicer because of it. There is also the addition of the obiligatory new wifi driver, just because it has been a release or two since we added our last one... Other than that, lots and lots of small coding style fixes, as usual. All of these have been in linux-next for a while with no reported issues" * tag 'staging-4.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (612 commits) staging:rtl8188eu:core Fix remove unneccessary else block staging: typec: fusb302: make structure fusb302_psy_desc static staging: unisys: visorbus: make two functions static staging: fsl-dpaa2/eth: fix off-by-one FD ctrl bitmaks staging: r8822be: Simplify deinit_priv() staging: r8822be: Remove some dead code staging: vboxvideo: Use CONFIG_DRM_KMS_FB_HELPER to check for fbdefio availability staging:rtl8188eu Fix comparison to NULL staging: rts5208: rename mmc_ddr_tunning_rx_cmd to mmc_ddr_tuning_rx_cmd Staging: Pi433: style fix - tabs and spaces staging: pi433: fix spelling mistake: "preample" -> "preamble" staging:rtl8188eu:core Fix Code Indent staging: typec: fusb302: Export current-limit through a power_supply class dev staging: typec: fusb302: Add support for USB2 charger detection through extcon staging: typec: fusb302: Use client->irq as irq if set staging: typec: fusb302: Get max snk mv/ma/mw from device-properties staging: typec: fusb302: Set max supply voltage to 5V staging: typec: tcpm: Add get_current_limit tcpc_dev callback staging:rtl8188eu Use __func__ instead of function name staging: lustre: coding style fixes found by checkpatch.pl ...
2017-09-05Merge tag 'tty-4.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/ttyLinus Torvalds63-286/+1568
Pull tty/serial updates from Greg KH: "Here is the big tty/serial driver update for 4.14-rc1. Well, not all that big, just a number of small serial driver fixes, and a new serial driver. Also in here are some much needed goldfish tty driver (emulator) fixes to try to get that codebase under control. All of these have been in linux-next for a while with no reported issues" * tag 'tty-4.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: (94 commits) tty: goldfish: Implement support for kernel 'earlycon' parameter tty: goldfish: Use streaming DMA for r/w operations on Ranchu platforms tty: goldfish: Refactor constants to better reflect their nature serial: 8250_port: Remove useless NULL checks earlycon: initialise baud field of earlycon device structure tty: hvcs: make ktermios const pty: show associative slave of ptmx in fdinfo tty: n_gsm: Add compat_ioctl tty: hvcs: constify vio_device_id tty: hvc_vio: constify vio_device_id tty: mips_ejtag_fdc: constify mips_cdmm_device_id Introduce 8250_men_mcb mcb: introduce mcb_get_resource() serial: imx: Avoid post-PIO cleanup if TX DMA is started tty: serial: imx: disable irq after suspend serial: 8250_uniphier: add suspend/resume support serial: 8250_uniphier: use CHAR register for canary to detect power-off serial: 8250_uniphier: fix serial port index in private data serial: 8250: of: Add new port type for MediaTek BTIF controller on MT7622/23 SoC dt-bindings: serial: 8250: Add MediaTek BTIF controller bindings ...
2017-09-05Merge branch 'parisc-4.14-1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linuxLinus Torvalds2-11/+11
Pull parisc updates from Helge Deller: "Major changes include: - Full support of the firmware Page Deallocation Table with MADV_HWPOISON and MADV_SOFT_OFFLINE. A kernel thread scans regularily for new bad memory pages. - Full support for self-extracting kernel. - Added UBSAN support. - Lots of section mismatch fixes across all parisc drivers. - Added examples for %pF and %pS usage in printk-formats.txt" * 'parisc-4.14-1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux: (28 commits) printk-formats.txt: Add examples for %pF and %pS usage parisc: Fix up devices below a PCI-PCI MegaRAID controller bridge parisc/core: Fix section mismatches parisc/ipmi_si_intf: Fix section mismatches on parisc platform parisc/input/hilkbd: Fix section mismatches parisc/net/lasi_82596: Fix section mismatches parisc/serio: Fix section mismatches in gscps2 and hp_sdc drivers parisc: Fix section mismatches in parisc core drivers parisc/parport_gsc: Fix section mismatches parisc/scsi/lasi700: Fix section mismatches parisc/scsi/zalon: Fix section mismatches parisc/8250_gsc: Fix section mismatches parisc/mux: Fix section mismatches parisc/sticore: Fix section mismatches parisc/harmony: Fix section mismatches parisc: Wire up support for self-extracting kernel parisc: Make existing core files reuseable for bootloader parisc: Add core code for self-extracting kernel parisc: Enable UBSAN support parisc/random: Add machine specific randomness ...
2017-09-04Merge branch 'x86-asm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tipLinus Torvalds1-1/+1
Pull x86 asm updates from Ingo Molnar: - Introduce the ORC unwinder, which can be enabled via CONFIG_ORC_UNWINDER=y. The ORC unwinder is a lightweight, Linux kernel specific debuginfo implementation, which aims to be DWARF done right for unwinding. Objtool is used to generate the ORC unwinder tables during build, so the data format is flexible and kernel internal: there's no dependency on debuginfo created by an external toolchain. The ORC unwinder is almost two orders of magnitude faster than the (out of tree) DWARF unwinder - which is important for perf call graph profiling. It is also significantly simpler and is coded defensively: there has not been a single ORC related kernel crash so far, even with early versions. (knock on wood!) But the main advantage is that enabling the ORC unwinder allows CONFIG_FRAME_POINTERS to be turned off - which speeds up the kernel measurably: With frame pointers disabled, GCC does not have to add frame pointer instrumentation code to every function in the kernel. The kernel's .text size decreases by about 3.2%, resulting in better cache utilization and fewer instructions executed, resulting in a broad kernel-wide speedup. Average speedup of system calls should be roughly in the 1-3% range - measurements by Mel Gorman [1] have shown a speedup of 5-10% for some function execution intense workloads. The main cost of the unwinder is that the unwinder data has to be stored in RAM: the memory cost is 2-4MB of RAM, depending on kernel config - which is a modest cost on modern x86 systems. Given how young the ORC unwinder code is it's not enabled by default - but given the performance advantages the plan is to eventually make it the default unwinder on x86. See Documentation/x86/orc-unwinder.txt for more details. - Remove lguest support: its intended role was that of a temporary proof of concept for virtualization, plus its removal will enable the reduction (removal) of the paravirt API as well, so Rusty agreed to its removal. (Juergen Gross) - Clean up and fix FSGS related functionality (Andy Lutomirski) - Clean up IO access APIs (Andy Shevchenko) - Enhance the symbol namespace (Jiri Slaby) * 'x86-asm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (47 commits) objtool: Handle GCC stack pointer adjustment bug x86/entry/64: Use ENTRY() instead of ALIGN+GLOBAL for stub32_clone() x86/fpu/math-emu: Add ENDPROC to functions x86/boot/64: Extract efi_pe_entry() from startup_64() x86/boot/32: Extract efi_pe_entry() from startup_32() x86/lguest: Remove lguest support x86/paravirt/xen: Remove xen_patch() objtool: Fix objtool fallthrough detection with function padding x86/xen/64: Fix the reported SS and CS in SYSCALL objtool: Track DRAP separately from callee-saved registers objtool: Fix validate_branch() return codes x86: Clarify/fix no-op barriers for text_poke_bp() x86/switch_to/64: Rewrite FS/GS switching yet again to fix AMD CPUs selftests/x86/fsgsbase: Test selectors 1, 2, and 3 x86/fsgsbase/64: Report FSBASE and GSBASE correctly in core dumps x86/fsgsbase/64: Fully initialize FS and GS state in start_thread_common x86/asm: Fix UNWIND_HINT_REGS macro for older binutils x86/asm/32: Fix regs_get_register() on segment registers x86/xen/64: Rearrange the SYSCALL entries x86/asm/32: Remove a bunch of '& 0xffff' from pt_regs segment reads ...
2017-08-31tty: goldfish: Implement support for kernel 'earlycon' parameterMiodrag Dinic2-0/+29
Add early console functionality to the Goldfish tty driver. When 'earlycon' kernel command line parameter is used with no options, the early console is determined by the 'stdout-path' property in device tree's 'chosen' node. This is illustrated in the following device tree source example: Device tree example: chosen { stdout-path = "/goldfish_tty@1f004000"; }; goldfish_tty@1f004000 { interrupts = <0xc>; reg = <0x1f004000 0x0 0x1000>; compatible = "google,goldfish-tty"; }; Signed-off-by: Miodrag Dinic <miodrag.dinic@imgtec.com> Signed-off-by: Goran Ferenc <goran.ferenc@imgtec.com> Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-31tty: goldfish: Use streaming DMA for r/w operations on Ranchu platformsMiodrag Dinic1-27/+139
Implement tty r/w operations using streaming DMA. Goldfish tty for Ranchu platforms has been modified to use streaming DMA mappings for read/write operations. This change eliminates the need for snooping through the TLB in QEMU using cpu_get_phys_page_debug() which does not guarantee that it will return the valid va -> pa mapping. The streaming DMA mapping is implemented using dma_map_single() per transfer, while dma_unmap_single() is used for unmapping right after the DMA transfer. Using DMA API is the proper way for handling r/w transfers and makes this driver more portable, thus effectively eliminating the need for virt_to_page() and page_to_phys() conversions. This change does not affect the old style Goldfish tty behaviour which is still used by the Goldfish emulator. Version register has been added and probed to see which platform is running this driver. Reading from the new register GOLDFISH_TTY_REG_VERSION using the Goldfish emulator will return 0 and driver will work with virtual addresses. Whereas if run on Ranchu it returns 1, and thus DMA is used. (Goldfish and Ranchu are code names for the first and the second generation of virtual boards used by Android emulator.) Signed-off-by: Miodrag Dinic <miodrag.dinic@imgtec.com> Signed-off-by: Goran Ferenc <goran.ferenc@imgtec.com> Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-31tty: goldfish: Refactor constants to better reflect their natureAleksandar Markovic1-27/+25
Classify constants GOLDFISH_TTY_xxx into two groups: command ids and register offsets. Apply different naming for register offsets (add 'REG_' after 'GOLDFISH_TTY_' in constant names). Change implementation to use preprocessor's '#define' statements instead of 'enum' declaration (as this is more common way of implementation in such cases). This makes the driver code easier to follow and hopefully prevents future bugs. Signed-off-by: Miodrag Dinic <miodrag.dinic@imgtec.com> Signed-off-by: Goran Ferenc <goran.ferenc@imgtec.com> Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-31serial: 8250_port: Remove useless NULL checksAndy Shevchenko1-4/+4
After switching to HR timers for RS485 the NULL checks for the object inside timer functions become useless. Remove them to avoid confusion to static analyzers. Fixes 6e0a5de2136b ("serial: 8250: Use hrtimers for rs485 delays") Cc: Colin Ian King <colin.king@canonical.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-31earlycon: initialise baud field of earlycon device structureEugeniy Paltsev1-0/+5
For now baud field of earlycon structure device is't initialised at all in of_setup_earlycon (in oppositе to register_earlycon). So when I use stdout-path to point earlycon device (like stdout-path = &serial or stdout-path = "serial:115200n8") baud field of earlycon device structure remains uninitialised and earlycon initialization is not performed correctly as of_setup_earlycon is used. When pass all arguments via bootargs (like bootargs = "earlycon=uart8250,mmio32,0xf0005000,115200n8") initialization is performed correctly as register_earlycon is used. So initialise baud field of earlycon device structure by value of "current-speed" property from device tree or from options (if they exist) when we use of_setup_earlycon Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-29sparc64: vcc: make ktermios constBhumika Goyal1-1/+1
Make this const as it is not modified anywhere. Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2017-08-29tty: hvcs: make ktermios constBhumika Goyal1-1/+1
Make this const as it is not modified anywhere. Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Reviewed-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-28sparc64: vcc: Check for IS_ERR() instead of NULLDan Carpenter1-2/+2
The tty_alloc_driver() function never returns NULL, it returns error pointers on error. Fixes: ce808b746325 ("sparc64: vcc: TTY driver initialization and cleanup") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2017-08-28pty: show associative slave of ptmx in fdinfoMasatake YAMATO2-1/+16
This patch adds "tty-index" field to /proc/PID/fdinfo/N if N specifies /dev/ptmx. The field shows the index of associative slave pts. Though a minor number is given for each pts instance, ptmx is not. It means there is no way in user-space to know the association between file descriptors for pts/n and ptmx. (n = 0, 1, ...) This is different from pipe. About pipe such association can be solved by inode of pipefs. Providing the way to know the association between pts/n and ptmx helps users understand the status of running system. lsof can utilize this field. Signed-off-by: Masatake YAMATO <yamato@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-28tty: n_gsm: Add compat_ioctlLars Poeschel1-0/+11
To use this driver with 32 bit userspace applications on 64 bit kernels a compat_ioctl is needed. Signed-off-by: Lars Poeschel <poeschel@lemonage.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-28tty: hvcs: constify vio_device_idArvind Yadav1-1/+1
vio_device_id are not supposed to change at runtime. All functions working with vio_device_id provided by <asm/vio.h> work with const vio_device_id. So mark the non-const structs as const. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-28tty: hvc_vio: constify vio_device_idArvind Yadav1-1/+1
vio_device_id are not supposed to change at runtime. All functions working with vio_device_id provided by <asm/vio.h> work with const vio_device_id. So mark the non-const structs as const. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-28tty: mips_ejtag_fdc: constify mips_cdmm_device_idArvind Yadav1-1/+1
mips_cdmm_device_id are not supposed to change at runtime. mips_cdmm_driver is working with const 'id_table'. So mark the non-const mips_cdmm_device_id structs as const. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-28Introduce 8250_men_mcbMichael Moese3-0/+130
This patch introduces the 8250_men_mcb driver for the MEN 16Z125 IP-Core. This is a 16550-type UART with a 60 byte FIFO. Due to strange old hardware, every board using this IP core requires different values for uartclk. A reasonable default is included in addition to the support of three boards. Additional values for other boards will be added later. This v2 has some whitespace fixes, I screwed this up yesterday. Signed-off-by: Michael Moese <michael.moese@men.de> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-28serial: imx: Avoid post-PIO cleanup if TX DMA is startedIan Jamison1-1/+4
The imx_transmit_buffer function should return if TX DMA has already been started and not just skip over the buffer PIO write loop. (Which did fix the initial problem, but could have unintentional side-effects) Tested on an i.MX6Q board with half-duplex RS-485 and with RS-232. Cc: Clemens Gruber <clemens.gruber@pqgruber.com> Cc: Uwe-Kleine König <u.kleine-koenig@pengutronix.de> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Fabio Estevam <fabio.estevam@nxp.com> Fixes: 514ab34dbad6 ("serial: imx: Prevent TX buffer PIO write when a DMA has been started") Signed-off-by: Ian Jamison <ian.dev@arkver.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-28tty: serial: imx: disable irq after suspendMaxim Yu. Osipov1-0/+2
If any key on console is pressed when board is suspended, board hangs. Driver's interrupt handler must be guaranteed not to run while resume/suspend_noirq() are being executed. See include/linux/pm.h for details. Tested on i.MX6 based board. The idea of this fix is based on commit in official i.MX kernel tree: http://git.freescale.com/git/cgit.cgi/imx/linux-2.6-imx.git commit 81e8e7d91d81 ("tty: serial: imx: disable irq after suspend") Disable rx irq after suspend to avoid interrupt coming in early resume. Signed-off-by: Fugang Duan <B38611@freescale.com> Signed-off-by: Maxim Yu. Osipov <mosipov@ilbers.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-28serial: 8250_uniphier: add suspend/resume supportMasahiro Yamada1-0/+35
Add suspend/resume support for UniPhier serial driver. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-28serial: 8250_uniphier: use CHAR register for canary to detect power-offMasahiro Yamada1-6/+16
The 8250 core uses the SCR as a canary to discover if the console has been powered-off. This hardware does not have SCR at offset 7, but an unused register CHAR at a different offset. As long as the character interrupt is disabled, the register access has no impact, so it is useful as an alternative scratch register. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-28serial: 8250_uniphier: fix serial port index in private dataMasahiro Yamada1-3/+3
serial8250_register_8250_port() may allocate a different port index than requested. The driver needs to remember the returned value of serial8250_register_8250_port() for later use. Otherwise, the .remove hook may unregister a different port. Fixes: 1a8d2903cb6a ("serial: 8250_uniphier: add UniPhier serial driver") Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-28serial: 8250: of: Add new port type for MediaTek BTIF controller on MT7622/23 SoCSean Wang2-0/+10
MediaTek BTIF controller is the serial interface similar to UART but it works only as the digital device which is mainly used to communicate with the connectivity module called CONNSYS inside the SoC which could be mostly found on those MediaTek SoCs with Bluetooth feature such as MT7622 and MT7623 SoCs. And the controller is made as being compatible with the 8250 register layout with extra registers such as DMA enablement so it tends to be integrated with reusing 8250 OF driver. However, DMA mode is not being supported yet in the current driver. Signed-off-by: Sean Wang <sean.wang@mediatek.com> Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-28serial: earlycon: Only try fdt when specify 'earlycon' exactlyJeffy Chen1-1/+1
When moving earlycon early_param handling to serial, the devicetree earlycons enable condition changed slightly. We used to only do that for 'console'/'earlycon', but now would also for 'console='/'earlycon='. Fix it by using the same condition like before. Fixes: d503187b6cc4 (of/serial: move earlycon early_param handling to serial) Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-28serial: mux: constify uart_ops structuresJulia Lawall1-1/+1
These uart_ops structures are only stored in the ops field of a uart_port structure and this fields is const, so the uart_ops structures can also be const. Done with the help of Coccinelle. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-28serial: sunsu: constify uart_ops structuresJulia Lawall1-1/+1
These uart_ops structures are only stored in the ops field of a uart_port structure and this fields is const, so the uart_ops structures can also be const. Done with the help of Coccinelle. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Acked-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-28serial: mpc52xx: constify uart_ops structuresJulia Lawall1-1/+1
These uart_ops structures are only stored in the ops field of a uart_port structure and this fields is const, so the uart_ops structures can also be const. Done with the help of Coccinelle. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-28serial: m32r_sio: constify uart_ops structuresJulia Lawall1-1/+1
These uart_ops structures are only stored in the ops field of a uart_port structure and this fields is const, so the uart_ops structures can also be const. Done with the help of Coccinelle. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-28serial: cpm_uart: constify uart_ops structuresJulia Lawall1-1/+1
These uart_ops structures are only stored in the ops field of a uart_port structure and this fields is const, so the uart_ops structures can also be const. Done with the help of Coccinelle. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-28serial: apbuart: constify uart_ops structuresJulia Lawall1-1/+1
These uart_ops structures are only stored in the ops field of a uart_port structure and this fields is const, so the uart_ops structures can also be const. Done with the help of Coccinelle. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-28serial: sunsab: constify uart_ops structuresJulia Lawall1-1/+1
These uart_ops structures are only stored in the ops field of a uart_port structure and this fields is const, so the uart_ops structures can also be const. Done with the help of Coccinelle. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Acked-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-28serial: 21285: constify uart_ops structuresJulia Lawall1-1/+1
These uart_ops structures are only stored in the ops field of a uart_port structure and this fields is const, so the uart_ops structures can also be const. Done with the help of Coccinelle. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-28serial: uuc_uart: constify uart_ops structuresJulia Lawall1-1/+1
These uart_ops structures are only stored in the ops field of a uart_port structure and this fields is const, so the uart_ops structures can also be const. Done with the help of Coccinelle. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Acked-by: Timur Tabi <timur@tabi.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-28tty: mux: constify parisc_device_idArvind Yadav1-2/+2
parisc_device_id are not supposed to change at runtime. All functions working with parisc_device_id provided by <asm/parisc-device.h> work with const parisc_device_id. So mark the non-const structs as const. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-28tty: 8250: constify parisc_device_idArvind Yadav1-2/+2
parisc_device_id are not supposed to change at runtime. All functions working with parisc_device_id provided by <asm/parisc-device.h> work with const parisc_device_id. So mark the non-const structs as const. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-28serial: 8250_of: Add basic PM runtime supportFranklin S Cooper Jr1-11/+24
66AK2G UART instances are not apart of the ALWAYS_ON power domain. Therefore, pm_runtime calls must be made to properly insure the appropriate power domains needed by UART are on. Keep legacy clk api calls since other users of this driver may not support PM runtime. Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-28serial: 8250_of: use of_property_read_bool()Sergei Shtylyov1-2/+2
Use slightly more compact of_property_read_bool() calls for the boolean properties instead of of_find_property() calls. Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-28serial: 8250: Use hrtimers for rs485 delaysRafael Gago1-23/+40
Previously the timers where based on the classic timers, giving a too coarse resolution on systems with configs of less than 1000 HZ. This patch changes the rs485 timers to hrtimers. Signed-off-by: Rafael Gago Castano <rgc@hms.se> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-28serial: core: Consider rs485 settings to drive RTSRafael Gago1-9/+25
Previously the rs485 settings weren't considered when setting the RTS line, so e.g. closing and reopening a port made serial_core to drive the line as if rs485 was disabled. This patch fixes those issues. Signed-off-by: Rafael Gago Castano <rgc@hms.se> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-28tty: serial: 8250_mtk: Use PTR_ERR_OR_ZEROHimanshu Jha1-4/+1
Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com> Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-28serial: sh-sci: use of_property_read_bool()Sergei Shtylyov1-2/+1
Use more compact of_property_read_bool() call for a boolean property instead of of_find_property() call in sci_parse_dt(). Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>