aboutsummaryrefslogtreecommitdiff
path: root/drivers/tty/vcc.c
AgeCommit message (Collapse)AuthorFilesLines
2023-09-18tty: vcc: Add check for kstrdup() in vcc_probe()Yi Yang1-3/+13
Add check for the return value of kstrdup() and return the error, if it fails in order to avoid NULL pointer dereference. Signed-off-by: Yi Yang <[email protected]> Reviewed-by: Jiri Slaby <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2023-08-11tty: vcc: convert counts to size_tJiri Slaby (SUSE)1-6/+6
Unify the type of tty_operations::write() counters with the 'count' parameter. I.e. use size_t for them. This includes changing vcc_port::chars_in_buffer to size_t to keep min() and avoid min_t(). Signed-off-by: "Jiri Slaby (SUSE)" <[email protected]> Cc: "David S. Miller" <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2023-08-11tty: make tty_operations::write()'s count size_tJiri Slaby (SUSE)1-2/+3
Unify with the rest of the code. Use size_t for counts and ssize_t for retval. Signed-off-by: "Jiri Slaby (SUSE)" <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2023-08-11tty: propagate u8 data to tty_operations::write()Jiri Slaby (SUSE)1-2/+1
Data are now typed as u8. Propagate this change to tty_operations::write(). Signed-off-by: "Jiri Slaby (SUSE)" <[email protected]> Cc: Richard Henderson <[email protected]> Cc: Ivan Kokshaysky <[email protected]> Cc: Matt Turner <[email protected]> Cc: Geert Uytterhoeven <[email protected]> Cc: Richard Weinberger <[email protected]> Cc: Anton Ivanov <[email protected]> Cc: Johannes Berg <[email protected]> Cc: Chris Zankel <[email protected]> Cc: Max Filippov <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Vaibhav Gupta <[email protected]> Cc: Jens Taprogge <[email protected]> Cc: Karsten Keil <[email protected]> Cc: Scott Branden <[email protected]> Cc: Ulf Hansson <[email protected]> Cc: "David S. Miller" <[email protected]> Cc: Eric Dumazet <[email protected]> Cc: Jakub Kicinski <[email protected]> Cc: Paolo Abeni <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Vasily Gorbik <[email protected]> Cc: Alexander Gordeev <[email protected]> Cc: Christian Borntraeger <[email protected]> Cc: Sven Schnelle <[email protected]> Cc: David Lin <[email protected]> Cc: Johan Hovold <[email protected]> Cc: Alex Elder <[email protected]> Cc: Laurentiu Tudor <[email protected]> Cc: Jiri Kosina <[email protected]> Cc: David Sterba <[email protected]> Cc: Shawn Guo <[email protected]> Cc: Sascha Hauer <[email protected]> Cc: Pengutronix Kernel Team <[email protected]> Cc: Fabio Estevam <[email protected]> Cc: NXP Linux Team <[email protected]> Cc: Arnaud Pouliquen <[email protected]> Cc: Oliver Neukum <[email protected]> Cc: Mathias Nyman <[email protected]> Cc: Marcel Holtmann <[email protected]> Cc: Johan Hedberg <[email protected]> Cc: Luiz Augusto von Dentz <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-09-09termios: start unifying non-UAPI parts of asm/termios.hAl Viro1-0/+1
* new header (linut/termios_internal.h), pulled by the users of those suckers * defaults for INIT_C_CC and externs for conversion helpers moved over there * remove termios-base.h (empty now) Signed-off-by: Al Viro <[email protected]> Link: https://lore.kernel.org/r/YxDmptU7dNGZ+/Hn@ZenIV Signed-off-by: Greg Kroah-Hartman <[email protected]>
2021-07-27tty: drop put_tty_driverJiri Slaby1-2/+2
put_tty_driver() is an alias for tty_driver_kref_put(). There is no need for two exported identical functions, therefore switch all users of old put_tty_driver() to new tty_driver_kref_put() and remove the former for good. Cc: Richard Henderson <[email protected]> Cc: Ivan Kokshaysky <[email protected]> Cc: Matt Turner <[email protected]> Cc: Geert Uytterhoeven <[email protected]> Cc: Jeff Dike <[email protected]> Cc: Richard Weinberger <[email protected]> Cc: Anton Ivanov <[email protected]> Cc: Chris Zankel <[email protected]> Cc: Max Filippov <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Samuel Iglesias Gonsalvez <[email protected]> Cc: Jens Taprogge <[email protected]> Cc: Karsten Keil <[email protected]> Cc: Scott Branden <[email protected]> Cc: Ulf Hansson <[email protected]> Cc: "David S. Miller" <[email protected]> Cc: Jakub Kicinski <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Vasily Gorbik <[email protected]> Cc: Christian Borntraeger <[email protected]> Cc: David Lin <[email protected]> Cc: Johan Hovold <[email protected]> Cc: Alex Elder <[email protected]> Cc: Jiri Slaby <[email protected]> Cc: Laurentiu Tudor <[email protected]> Cc: Jiri Kosina <[email protected]> Cc: David Sterba <[email protected]> Cc: Shawn Guo <[email protected]> Cc: Sascha Hauer <[email protected]> Cc: Pengutronix Kernel Team <[email protected]> Cc: Fabio Estevam <[email protected]> Cc: NXP Linux Team <[email protected]> Cc: Oliver Neukum <[email protected]> Cc: Felipe Balbi <[email protected]> Cc: Mathias Nyman <[email protected]> Cc: Marcel Holtmann <[email protected]> Cc: Johan Hedberg <[email protected]> Cc: Luiz Augusto von Dentz <[email protected]> Acked-by: Alex Elder <[email protected]> Acked-by: Christian Borntraeger <[email protected]> Acked-by: Max Filippov <[email protected]> Acked-by: David Sterba <[email protected]> Acked-by: Samuel Iglesias Gonsálvez <[email protected]> Signed-off-by: Jiri Slaby <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2021-07-05Merge tag 'tty-5.14-rc1' of ↵Linus Torvalds1-12/+12
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty Pull tty / serial updates from Greg KH: "Here is the big set of tty and serial driver patches for 5.14-rc1. A bit more than normal, but nothing major, lots of cleanups. Highlights are: - lots of tty api cleanups and mxser driver cleanups from Jiri - build warning fixes - various serial driver updates - coding style cleanups - various tty driver minor fixes and updates - removal of broken and disable r3964 line discipline (finally!) All of these have been in linux-next for a while with no reported issues" * tag 'tty-5.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: (227 commits) serial: mvebu-uart: remove unused member nb from struct mvebu_uart arm64: dts: marvell: armada-37xx: Fix reg for standard variant of UART dt-bindings: mvebu-uart: fix documentation serial: mvebu-uart: correctly calculate minimal possible baudrate serial: mvebu-uart: do not allow changing baudrate when uartclk is not available serial: mvebu-uart: fix calculation of clock divisor tty: make linux/tty_flip.h self-contained serial: Prefer unsigned int to bare use of unsigned serial: 8250: 8250_omap: Fix possible interrupt storm on K3 SoCs serial: qcom_geni_serial: use DT aliases according to DT bindings Revert "tty: serial: Add UART driver for Cortina-Access platform" tty: serial: Add UART driver for Cortina-Access platform MAINTAINERS: add me back as mxser maintainer mxser: Documentation, fix typos mxser: Documentation, make the docs up-to-date mxser: Documentation, remove traces of callout device mxser: introduce mxser_16550A_or_MUST helper mxser: rename flags to old_speed in mxser_set_serial_info mxser: use port variable in mxser_set_serial_info mxser: access info->MCR under info->slock ...
2021-06-04tty: vcc: use DEVICE_ATTR_*() macroZhen Lei1-8/+8
Use DEVICE_ATTR_*() macro helper instead of plain DEVICE_ATTR, which makes the code a bit shorter and easier to read. Acked-by: David S. Miller <[email protected]> Signed-off-by: Zhen Lei <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2021-05-14sparc/vio: make remove callback return voidUwe Kleine-König1-3/+1
The driver core ignores the return value of struct bus_type::remove() because there is only little that can be done. To simplify the quest to make this function return void, let struct vio_driver::remove() return void, too. All users already unconditionally return 0, this commit makes it obvious that returning an error code is a bad idea and should prevent that future driver authors consider returning an error code. Note there are two nominally different implementations for a vio bus: one in arch/sparc/kernel/vio.c and the other in arch/powerpc/platforms/pseries/vio.c. This patch only addresses the former. Acked-by: David S. Miller <[email protected]> Signed-off-by: Uwe Kleine-König <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2021-05-13tty: make tty_operations::chars_in_buffer return uintJiri Slaby1-2/+2
tty_operations::chars_in_buffer is another hook which is expected to return values >= 0. So make it explicit by the return type too -- use unsigned int. Signed-off-by: Jiri Slaby <[email protected]> Acked-By: Anton Ivanov <[email protected]> Acked-by: David Sterba <[email protected]> Cc: Jeff Dike <[email protected]> Cc: Richard Weinberger <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Samuel Iglesias Gonsalvez <[email protected]> Cc: Jens Taprogge <[email protected]> Cc: Karsten Keil <[email protected]> Cc: Ulf Hansson <[email protected]> Cc: "David S. Miller" <[email protected]> Cc: Jakub Kicinski <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Vasily Gorbik <[email protected]> Cc: Christian Borntraeger <[email protected]> Cc: David Lin <[email protected]> Cc: Johan Hovold <[email protected]> Cc: Alex Elder <[email protected]> Cc: Jiri Kosina <[email protected]> Cc: Shawn Guo <[email protected]> Cc: Sascha Hauer <[email protected]> Cc: Oliver Neukum <[email protected]> Cc: Felipe Balbi <[email protected]> Cc: Mathias Nyman <[email protected]> Cc: Marcel Holtmann <[email protected]> Cc: Johan Hedberg <[email protected]> Cc: Luiz Augusto von Dentz <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2021-05-13tty: make tty_operations::write_room return uintJiri Slaby1-2/+2
Line disciplines expect a positive value or zero returned from tty->ops->write_room (invoked by tty_write_room). So make this assumption explicit by using unsigned int as a return value. Both of tty->ops->write_room and tty_write_room. Signed-off-by: Jiri Slaby <[email protected]> Acked-by: Laurentiu Tudor <[email protected]> Acked-by: Alex Elder <[email protected]> Acked-by: Max Filippov <[email protected]> # xtensa Acked-by: David Sterba <[email protected]> Acked-By: Anton Ivanov <[email protected]> Acked-by: Geert Uytterhoeven <[email protected]> Cc: Richard Henderson <[email protected]> Cc: Ivan Kokshaysky <[email protected]> Cc: Matt Turner <[email protected]> Cc: "James E.J. Bottomley" <[email protected]> Cc: Helge Deller <[email protected]> Cc: Jeff Dike <[email protected]> Cc: Richard Weinberger <[email protected]> Cc: Chris Zankel <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Samuel Iglesias Gonsalvez <[email protected]> Cc: Jens Taprogge <[email protected]> Cc: Karsten Keil <[email protected]> Cc: Scott Branden <[email protected]> Cc: Ulf Hansson <[email protected]> Cc: "David S. Miller" <[email protected]> Cc: Jakub Kicinski <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Vasily Gorbik <[email protected]> Cc: Christian Borntraeger <[email protected]> Cc: David Lin <[email protected]> Cc: Johan Hovold <[email protected]> Cc: Jiri Kosina <[email protected]> Cc: Shawn Guo <[email protected]> Cc: Sascha Hauer <[email protected]> Cc: Oliver Neukum <[email protected]> Cc: Felipe Balbi <[email protected]> Cc: Mathias Nyman <[email protected]> Cc: Marcel Holtmann <[email protected]> Cc: Johan Hedberg <[email protected]> Cc: Luiz Augusto von Dentz <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2021-03-10tty: make everyone's write_room return >= 0Jiri Slaby1-1/+1
The tty line disciplines don't expect tty_operations::write_room to return negative values. Fix the five drivers which violate this. Signed-off-by: Jiri Slaby <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2021-03-10tty: make everyone's chars_in_buffer return >= 0Jiri Slaby1-1/+1
The tty line disciplines don't expect tty_operations::chars_in_buffer to return negative values. Fix the two drivers which violate this. Signed-off-by: Jiri Slaby <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2021-03-10tty: vcc, remove useless tty checksJiri Slaby1-45/+0
All these functions are called with a valid tty pointer, no need to check that. Cc: "David S. Miller" <[email protected]> Cc: [email protected] Signed-off-by: Jiri Slaby <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2021-03-10tty: vcc, use name strings directlyJiri Slaby1-4/+2
Do not define global variables for driver/device names, use the strings directly. Cc: "David S. Miller" <[email protected]> Cc: [email protected] Signed-off-by: Jiri Slaby <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2021-03-10tty: vcc, drop version dumpJiri Slaby1-10/+1
The version number is artificial, no need to dump it to logs during initialization. Cc: "David S. Miller" <[email protected]> Cc: <[email protected]> Signed-off-by: Jiri Slaby <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2021-03-10tty: vcc, make globals staticJiri Slaby1-3/+3
These are used only in this unit, so make them static. Signed-off-by: Jiri Slaby <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2021-01-15tty: vcc: Drop impossible to hit WARN_ONUwe Kleine-König1-5/+2
vcc_get() returns the port that has provided port->index. As the port that is about to be removed isn't removed yet this trivially will find this port. So simplify the call to not assign an identical value to the port pointer and drop the warning that is never hit. Reviewed-by: Jiri Slaby <[email protected]> Signed-off-by: Uwe Kleine-König <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2021-01-15tty: vcc: Drop unnecessary if blockUwe Kleine-König1-3/+0
If vcc_probe() succeeded dev_set_drvdata() is called with a non-NULL value, and if vcc_probe() failed vcc_remove() isn't called. So there is no way dev_get_drvdata() can return NULL in vcc_remove() and the check can just go away. Reviewed-by: Jiri Slaby <[email protected]> Signed-off-by: Uwe Kleine-König <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2020-04-28sparc64: vcc: Fix error return code in vcc_probe()Wei Yongjun1-0/+1
Fix to return negative error code -ENOMEM from the error handling case instead of 0, as done elsewhere in this function. Signed-off-by: Wei Yongjun <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-04-04tty: fix up a few remaining files without SPDX identifiersGreg Kroah-Hartman1-0/+1
There were a few straggling files under drivers/tty/ that did not have any SPDX identifier either because they entered the tree recently, or they somehow missed the mass-tagging of commit b24413180f56 ("License cleanup: add SPDX GPL-2.0 license identifier to files with no license") This commit follows the same rule as b24413180f56 ("License cleanup: add SPDX GPL-2.0 license identifier to files with no license") where files without any specified license in them fall under GPL-2.0 as the correct license for the individual file. Add that identifier to these remaining files so that we don't have to guess at the license of them in the future. Cc: Jiri Slaby <[email protected]> Cc: "David S. Miller" <[email protected]> Reviewed-by: Mukesh Ojha <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-11-04tty: vcc: Convert timers to use timer_setup()Kees Cook1-14/+6
In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly. Cc: "David S. Miller" <[email protected]> Cc: Jiri Slaby <[email protected]> Cc: [email protected] Signed-off-by: Kees Cook <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-10-03drivers: tty: vcc: use setup_timer() helper.Allen Pais1-7/+2
Use setup_timer function instead of initializing timer with the function and data fields. Signed-off-by: Allen Pais <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-08-29sparc64: vcc: make ktermios constBhumika Goyal1-1/+1
Make this const as it is not modified anywhere. Signed-off-by: Bhumika Goyal <[email protected]> Signed-off-by: David S. Miller <[email protected]>
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2017-08-15sparc64: vcc: Add install & cleanup TTY operationsJag Raman1-0/+73
Add handlers to support TTY install & cleanup operations Signed-off-by: Jagannathan Raman <[email protected]> Reviewed-by: Liam Merwick <[email protected]> Reviewed-by: Shannon Nelson <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2017-08-15sparc64: vcc: Add break_ctl TTY operationJag Raman1-0/+35
Add handler to support TTY break_ctl operation Signed-off-by: Jagannathan Raman <[email protected]> Reviewed-by: Liam Merwick <[email protected]> Reviewed-by: Shannon Nelson <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2017-08-15sparc64: vcc: Add chars_in_buffer TTY operationJag Raman1-5/+29
Add handler to support TTY chars_in_buffer operation Signed-off-by: Jagannathan Raman <[email protected]> Reviewed-by: Liam Merwick <[email protected]> Reviewed-by: Shannon Nelson <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2017-08-15sparc64: vcc: Add write & write_room TTY operationsJag Raman1-3/+98
Add handlers to support TTY write & write_room operations Signed-off-by: Jagannathan Raman <[email protected]> Reviewed-by: Liam Merwick <[email protected]> Reviewed-by: Shannon Nelson <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2017-08-15sparc64: vcc: Add hangup TTY operationJag Raman1-0/+41
Add handler to support TTY hangup operation Signed-off-by: Jagannathan Raman <[email protected]> Reviewed-by: Liam Merwick <[email protected]> Reviewed-by: Shannon Nelson <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2017-08-15sparc64: vcc: Add open & close TTY operationsJag Raman1-1/+62
Add handlers to support TTY open & close operations Signed-off-by: Jagannathan Raman <[email protected]> Reviewed-by: Liam Merwick <[email protected]> Reviewed-by: Shannon Nelson <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2017-08-15sparc64: vcc: Enable LDC event processing engineJag Raman1-0/+34
Enable event processing engine to handle LDC events Signed-off-by: Jagannathan Raman <[email protected]> Reviewed-by: Liam Merwick <[email protected]> Reviewed-by: Shannon Nelson <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2017-08-15sparc64: vcc: Add RX & TX timer for delayed LDC operationJag Raman1-2/+193
Add RX & TX timers to perform delayed/asynchronous LDC read and write operations. Signed-off-by: Jagannathan Raman <[email protected]> Reviewed-by: Liam Merwick <[email protected]> Reviewed-by: Shannon Nelson <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2017-08-15sparc64: vcc: Create sysfs attribute groupJag Raman1-0/+82
Create sysfs attribute group to show the domain name and send break command. Signed-off-by: Jagannathan Raman <[email protected]> Reviewed-by: Liam Merwick <[email protected]> Reviewed-by: Shannon Nelson <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2017-08-15sparc64: vcc: Enable VCC port probe and removalJag Raman1-0/+379
Enables VCC port probe and removal to initialize and terminate VCC ports respectively. When a device/port matching the VCC driver is added, the probe function is invoked along with a reference to the device. remove function is called when the device is removed. Also add APIs to cache and retrieve VCC ports from a VCC table Signed-off-by: Jagannathan Raman <[email protected]> Reviewed-by: Liam Merwick <[email protected]> Reviewed-by: Shannon Nelson <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2017-08-15sparc64: vcc: TTY driver initialization and cleanupJag Raman1-1/+82
Allocate and register TTY driver during module init. Cleanup TTY driver during module exit. Signed-off-by: Jagannathan Raman <[email protected]> Reviewed-by: Liam Merwick <[email protected]> Reviewed-by: Shannon Nelson <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2017-08-15sparc64: vcc: Add VCC debug message macrosJag Raman1-0/+41
Add C macros to print debug messages from VCC module Signed-off-by: Jagannathan Raman <[email protected]> Reviewed-by: Liam Merwick <[email protected]> Reviewed-by: Shannon Nelson <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2017-08-15sparc64: vcc: Enable VCC module in linuxJag Raman1-0/+18
Enables the Virtual Console Concentrator (VCC) module in linux kernel Signed-off-by: Jagannathan Raman <[email protected]> Reviewed-by: Liam Merwick <[email protected]> Reviewed-by: Shannon Nelson <[email protected]> Signed-off-by: David S. Miller <[email protected]>