aboutsummaryrefslogtreecommitdiff
path: root/drivers/tty
AgeCommit message (Collapse)AuthorFilesLines
2024-03-02serial: 8250_exar: Use 8250 PCI library to map and assign resourcesGravatar Andy Shevchenko 2-5/+7
8250 PCI library provides a common code to map and assign resources. Use it in order to deduplicate existing code and support IO port variants. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20240219150627.2101198-7-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-03-02serial: 8250_exar: switch to DEFINE_SIMPLE_DEV_PM_OPS()Gravatar Andy Shevchenko 1-4/+5
SIMPLE_DEV_PM_OPS() is deprecated, replace it with DEFINE_SIMPLE_DEV_PM_OPS() and use pm_sleep_ptr() for setting the driver's PM routines. We can now remove the __maybe_unused qualifier in the suspend and resume functions. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20240219150627.2101198-6-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-03-02serial: 8250_exar: Use generic function to set firmware nodeGravatar Andy Shevchenko 1-2/+2
Use generic function to set firmware node instead of ACPI specific one. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20240219150627.2101198-5-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-03-02serial: 8250_exar: Clear interrupts before registering handlerGravatar Andy Shevchenko 1-3/+3
While now there is no issue if IRQ is fired before we clearing the interrupts as the handler does the same, but strictly speaking it might be problematic if IRQ handler wants to do something more. Move clearing interrupt code to be called before registering the IRQ handler. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20240219150627.2101198-4-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-03-02serial: 8250_exar: Use dev_get_drvdata() directly in PM callbacksGravatar Andy Shevchenko 1-2/+1
PM callbacks take struct device pointer as a parameter, use dev_get_drvdata() to retrieve it instead of unneeded double loop of referencing via pci_get_drvdata(to_pci_dev(dev)). Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20240219150627.2101198-3-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-03-02serial: 8250_exar: Don't remove GPIO device on suspendGravatar Andy Shevchenko 1-4/+1
It seems a copy&paste mistake that suspend callback removes the GPIO device. There is no counterpart of this action, means once suspended there is no more GPIO device available untile full unbind-bind cycle is performed. Remove suspicious GPIO device removal in suspend. Fixes: d0aeaa83f0b0 ("serial: exar: split out the exar code from 8250_pci") Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20240219150627.2101198-2-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-02-27Merge 6.8-rc6 into tty-nextGravatar Greg Kroah-Hartman 3-34/+38
We need the tty/serial fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-02-23tty: mips_ejtag_fdc: Fix passing incompatible pointer type warningGravatar Serge Semin 1-1/+1
mips_ejtag_fdc_encode() method expects having a first argument passed of the "u8 **" type, meanwhile the driver passes the "const char **" type. That causes the next build-warning: drivers/tty/mips_ejtag_fdc.c: In function ‘mips_ejtag_fdc_console_write’: drivers/tty/mips_ejtag_fdc.c:343:32: error: passing argument 1 of ‘mips_ejtag_fdc_encode’ from incompatible pointer type [-Werror=incompatible-pointer-types] word = mips_ejtag_fdc_encode(&buf_ptr, &buf_len, 1); ^ drivers/tty/mips_ejtag_fdc.c:216:24: note: expected ‘const u8 ** {aka const unsigned char **}’ but argument is of type ‘const char **’ static struct fdc_word mips_ejtag_fdc_encode(const u8 **ptrs, ^~~~~~~~~~~~~~~~~~~~~ Fix it by altering the type of the pointer which is passed to the mips_ejtag_fdc_encode() method. Fixes: ce7cbd9a6c81 ("tty: mips_ejtag_fdc: use u8 for character pointers") Signed-off-by: Serge Semin <fancer.lancer@gmail.com> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
2024-02-19serial: amba-pl011: Fix DMA transmission in RS485 modeGravatar Lino Sanfilippo 1-30/+30
When DMA is used in RS485 mode make sure that the UARTs tx section is enabled before the DMA buffers are queued for transmission. Cc: stable@vger.kernel.org Fixes: 8d479237727c ("serial: amba-pl011: add RS485 support") Signed-off-by: Lino Sanfilippo <l.sanfilippo@kunbus.com> Link: https://lore.kernel.org/r/20240216224709.9928-2-l.sanfilippo@kunbus.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-02-19serial: stm32: do not always set SER_RS485_RX_DURING_TX if RS485 is enabledGravatar Lino Sanfilippo 1-1/+3
Before commit 07c30ea5861f ("serial: Do not hold the port lock when setting rx-during-tx GPIO") the SER_RS485_RX_DURING_TX flag was only set if the rx-during-tx mode was not controlled by a GPIO. Now the flag is set unconditionally when RS485 is enabled. This results in an incorrect setting if the rx-during-tx GPIO is not asserted. Fix this by setting the flag only if the rx-during-tx mode is not controlled by a GPIO and thus restore the correct behaviour. Cc: stable@vger.kernel.org # 6.6+ Fixes: 07c30ea5861f ("serial: Do not hold the port lock when setting rx-during-tx GPIO") Signed-off-by: Lino Sanfilippo <l.sanfilippo@kunbus.com> Link: https://lore.kernel.org/r/20240216224709.9928-1-l.sanfilippo@kunbus.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-02-19tty: hvc: Don't enable the RISC-V SBI console by defaultGravatar Palmer Dabbelt 1-3/+5
The new SBI console has the same problem as the old one: there's only one shared backing hardware and no synchronization, so the two drivers end up stepping on each other. This was the same issue the old SBI-0.1 console drivers had, but that was disabled by default when SBI-0.1 was. So just mark the new driver as nonportable. Reported-by: Emil Renner Berthing <kernel@esmil.dk> Fixes: 88ead68e764c ("tty: Add SBI debug console support to HVC SBI driver") Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com> Reviewed-by: Paul Walmsley <paul.walmsley@sifive.com> Reviewed-by: Anup Patel <anup@brainfault.org> Reviewed-by: Conor Dooley <conor.dooley@microchip.com> Link: https://lore.kernel.org/r/20240214153429.16484-2-palmer@rivosinc.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-02-19serial: pmac_zilog: Convert to platform remove callback returning voidGravatar Uwe Kleine-König 1-7/+2
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Note that pmz_detach() is only called once pmz_attach() was successfully called. In that case platform_set_drvdata() was called and so platform_get_drvdata() won't return NULL. This allows to drop the respective check and so get rid of the only error path in pmz_detach(). After that the driver can be trivially converted from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/90b9a65ad8800b4d047aa5219959008a01588a94.1708246007.git.u.kleine-koenig@pengutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-02-19tty: goldfish: Convert to platform remove callback returning voidGravatar Uwe Kleine-König 1-3/+2
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/60d0657daf8f4f9e2e3e282941ba542f08dc7f96.1708246007.git.u.kleine-koenig@pengutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-02-19tty: amiserial: Convert to platform remove callback returning voidGravatar Uwe Kleine-König 1-4/+2
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/f2ad92c97086c42dab23cdb165d9f978bbf3d3b5.1708246007.git.u.kleine-koenig@pengutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-02-19Merge 6.8-rc5 into tty-nextGravatar Greg Kroah-Hartman 2-2/+5
We need the serial/tty fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-02-18tty: Don't include tty_buffer.h in tty.hGravatar Ilpo Järvinen 1-0/+1
There's no need to include linux/tty_buffer.h in linux/tty.h. Move the include into tty_buffer.c that is actually using it. Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20240215111538.1920-1-ilpo.jarvinen@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-02-18serial: 8250_of: Drop quirk fot NPCM from 8250_portGravatar Andy Shevchenko 2-26/+42
We are not supposed to spread quirks in 8250_port module especially when we have a separate driver for the hardware in question. Move quirk from generic module to the driver that uses it. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20240215145029.581389-1-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-02-18tty: jsm: Remove redundant assignment to variable linestatusGravatar Colin Ian King 1-1/+0
The variable linestate being assigned a value that is never read, the following continue statement jumps to the end of the while-loop and then it is re-assigned a new value. The assignment is redundant and can be removed. Cleans up clang scan build warning: drivers/tty/serial/jsm/jsm_cls.c:398:4: warning: Value stored to 'linestatus' is never read [deadcode.DeadStores] Signed-off-by: Colin Ian King <colin.i.king@gmail.com> Link: https://lore.kernel.org/r/20240216121732.2106445-1-colin.i.king@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-02-18serial: lpc32xx_hs: remove redundant check and assignment of hsu_rateGravatar Colin Ian King 1-2/+0
Variable hsu_rate is being checked for an upper limit and is assigned a value that is never read. The if statement and assignment are redundant and can be removed. Cleans up clang scan build warning: drivers/tty/serial/lpc32xx_hs.c:237:3: warning: Value stored to 'hsu_rate' is never read [deadcode.DeadStores] Signed-off-by: Colin Ian King <colin.i.king@gmail.com> Link: https://lore.kernel.org/r/20240215232944.2075789-1-colin.i.king@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-02-18serial: 8250_bcm7271: Replace custom unit definitionsGravatar Andy Shevchenko 1-9/+8
Replace custom unit definitions that are available via units.h. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> Link: https://lore.kernel.org/r/20240215160234.653305-1-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-02-17serial: 8250_pci1xxxx: Don't use "proxy" headersGravatar Andy Shevchenko 1-6/+14
Update header inclusions to follow IWYU (Include What You Use) principle. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Jiri Slaby <jirislaby@kernel.org> Link: https://lore.kernel.org/r/20240213193827.3207353-1-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-02-17tty: hvc-iucv: fix function pointer castsGravatar Arnd Bergmann 1-1/+5
clang warns about explicitly casting between incompatible function pointers: drivers/tty/hvc/hvc_iucv.c:1100:23: error: cast from 'void (*)(const void *)' to 'void (*)(struct device *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict] 1100 | priv->dev->release = (void (*)(struct device *)) kfree; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Add a separate function to handle this correctly. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Jiri Slaby <jirislaby@kernel.org> Link: https://lore.kernel.org/r/20240213101756.461701-1-arnd@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-02-17tty/vt: Corrected doc of vc_sanitize_unicode(), vc_translate_unicode()Gravatar Roman Žilka 1-4/+12
Corrected the doc of vc_sanitize_unicode() and vc_translate_unicode(), tightly coupled functions which parse UTF-8 byte sequences. 1. Desc. of @rescan corresponded to the meaning of the return value -1. Corrected + added "Return:" section. 2. Replaced the ambiguous "character" with "code point" or "byte". Signed-off-by: Roman Žilka <roman.zilka@gmail.com> Link: https://lore.kernel.org/r/bee9faa8-0ea7-4411-bf77-3cb2e06385c7@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-02-06serial: mxs-auart: fix txGravatar Jiri Slaby (SUSE) 1-1/+4
Emil reports: After updating Linux on an i.MX28 board, serial communication over AUART broke. When I TX from the board and measure on the TX pin, it seems like the HW fifo is not emptied before the transmission is stopped. MXS performs weird things with stop_tx(). The driver makes it conditional on uart_tx_stopped(). So the driver needs special handling. Pass the brand new UART_TX_NOSTOP to uart_port_tx_flags() and handle the stop on its own. Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org> Reported-by: Emil Kronborg <emil.kronborg@protonmail.com> Cc: stable <stable@kernel.org> Fixes: 2d141e683e9a ("tty: serial: use uart_port_tx() helper") Closes: https://lore.kernel.org/all/miwgbnvy3hjpnricubg76ytpn7xoceehwahupy25bubbduu23s@om2lptpa26xw/ Tested-by: Stefan Wahren <wahrenst@gmx.net> Tested-by: Emil Kronborg <emil.kronborg@protonmail.com> Link: https://lore.kernel.org/r/20240201105557.28043-2-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-02-06serial: 8250_pci1xxxx: partially revert off by one patchGravatar Dan Carpenter 1-1/+1
I was reviewing this code again and I realized I made a mistake here. It should have been > instead of >=. The subtract ensures that we don't go out of bounds. My patch meant that we don't read the last chunk of the buffer. Fixes: 86ee55e9bc7f ("serial: 8250_pci1xxxx: fix off by one in pci1xxxx_process_read_data()") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://lore.kernel.org/r/bd6fb361-bbb9-427d-90e8-a5df4de76221@moroto.mountain Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-02-06tty: vt: decrypt magic constants in vc_is_control()Gravatar Jiri Slaby (SUSE) 1-3/+7
0x0d00ff81 and 0x0800f501 are bitmasks of ASCII characters. Spell them explicitly using BIT() + ASCII constants. GENMASK() is used for the 9-bit range in CTRL_ACTION. This also modifies the 'if' checking if the masks should be applied. >From a "random" ' ' to the actual size of the bitmasks' type. Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org> Link: https://lore.kernel.org/r/20240202065608.14019-23-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-02-06tty: vt: use ASCII enum constants in vt_console_print()Gravatar Jiri Slaby (SUSE) 1-4/+5
There are still numbers used for ASCII characters in vt_console_print(). As we have an ASCII enum now, use the constant names from the enum instead. Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org> Link: https://lore.kernel.org/r/20240202065608.14019-22-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-02-06tty: vt: use switch+case in the ESgetpars caseGravatar Jiri Slaby (SUSE) 1-4/+8
To be uniform in the 'c' handling, use switch-case (with ranges) even in the ESgetpars case in do_con_trol(). Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org> Link: https://lore.kernel.org/r/20240202065608.14019-21-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-02-06tty: vt: use switch+case in the ESnonstd caseGravatar Jiri Slaby (SUSE) 1-6/+8
To be uniform in the 'c' handling, use switch-case (with ranges) even in the ESnonstd case in do_con_trol(). Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org> Link: https://lore.kernel.org/r/20240202065608.14019-20-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-02-06tty: vt: add new helper for reseting vc parametersGravatar Jiri Slaby (SUSE) 1-6/+9
The code to reset the vc parameter parsing is repeated on two locations. Create a helper vc_reset_params() and use it on both of them. And instead of a 'for' loop to clear the array of parameters, use simpler memset(). Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org> Link: https://lore.kernel.org/r/20240202065608.14019-19-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-02-06tty: vt: handle CSI+[ inside preexisting switch-caseGravatar Jiri Slaby (SUSE) 1-4/+3
In do_con_trol()'s ESsquare case, there is already a switch (c). It is preceded by an 'if (c == '[')'. Despite this 'if' handles a state transition and not a modifier, move it as one of the switch cases. This makes all the 'c' decision making more obvious there. Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org> Link: https://lore.kernel.org/r/20240202065608.14019-18-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-02-06tty: vt: simplify ansi_control_string()Gravatar Jiri Slaby (SUSE) 1-5/+6
Given all the ANSI control states are sequential in the vc_ctl_state enum, we can define first/last constants and use them in ansi_control_string(). It makes the test simple and allows for removal of the 'if' (which was unnecessary at all -- the 'return' should have returned the 'if' content directly anyway). And remove the useless comment -- it's clear from the function prototype. Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org> Link: https://lore.kernel.org/r/20240202065608.14019-17-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-02-06tty: vt: name, reflow and document enum vc_ctl_stateGravatar Jiri Slaby (SUSE) 1-17/+55
The enum for states is currently compact and undocumented. Put each definition on a separate line and document them all using kernel-doc. Document the same on the use sites. Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org> Link: https://lore.kernel.org/r/20240202065608.14019-16-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-02-06tty: vt: move CSI ECMA handling to a separate functionGravatar Jiri Slaby (SUSE) 1-130/+139
Similar to previous moves, move also "CSI ..." (i.e. vc_priv == EPecma) handling to a separate function. This is the last large move of code out of do_con_trol(). And despite it is still 151 lines of code (down from 407!), it is now quite easy to folllow the transitions of the state machine in there. ESnonstd and ESpalette handling still can be moved away, but it won't improve that much. Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org> Link: https://lore.kernel.org/r/20240202065608.14019-15-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-02-06tty: vt: move CSI DEC handling to a separate functionGravatar Jiri Slaby (SUSE) 1-31/+44
The handling of "CSI ? ..." (i.e. vc_priv == EPdec) can be easily moved out of do_con_trol() into a separate function. This again increases readability of do_con_trol(). Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org> Link: https://lore.kernel.org/r/20240202065608.14019-14-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-02-06tty: vt: separate ESesc state handling into handle_esc()Gravatar Jiri Slaby (SUSE) 1-62/+72
Similar to the ASCII handling, the ESC handling can be easily moved away from do_con_trol(). So create a new handle_esc() for that. And add a comment with an example. Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org> Link: https://lore.kernel.org/r/20240202065608.14019-13-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-02-06tty: vt: extract ascii handling to handle_ascii()Gravatar Jiri Slaby (SUSE) 1-21/+37
To make the do_con_trol() a bit more understandable, extract the ASCII handling (the switch-case) to a separate function. Other nested switch-cases will follow in the next patches. Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org> Link: https://lore.kernel.org/r/20240202065608.14019-12-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-02-06tty: vt: accept u8 in do_con_trol() and vc_setGx()Gravatar Jiri Slaby (SUSE) 1-3/+3
These functions expect u8 as the control character. Switch the type from 'int' appropriately. The caller passing the value (do_con_write()) is fixed as well. Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org> Link: https://lore.kernel.org/r/20240202065608.14019-11-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-02-06tty: vt: put cases on separate linesGravatar Jiri Slaby (SUSE) 1-4/+8
Some cases of the CSI switch are stuffed on one line. Put them all to a separate line as is dictated by the coding style (and for better readability). Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org> Link: https://lore.kernel.org/r/20240202065608.14019-10-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-02-06tty: vt: rename setterm_command() to csi_RSB()Gravatar Jiri Slaby (SUSE) 1-4/+10
It follows naming of other similar functions. RSB stands here for Right Square Bracket as (obviously) ']' cannot be in the function name. Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org> Link: https://lore.kernel.org/r/20240202065608.14019-9-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-02-06tty: vt: define an enum for CSI+] codesGravatar Jiri Slaby (SUSE) 1-11/+25
Decrypt the constant values by proper enum names. This time in setterm_command() (to be renamed to csi_RSB() in the next patches). Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org> Link: https://lore.kernel.org/r/20240202065608.14019-8-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-02-06tty: vt: move CSI+n handling along to other ECMA CSIsGravatar Jiri Slaby (SUSE) 1-8/+6
CSIs without [<=>?] modifiers (ECMA) are handled in the switch-case below this DEC switch+case handler. So move this ECMA CSI+n there too as it fits there better. Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org> Link: https://lore.kernel.org/r/20240202065608.14019-7-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-02-06tty: vt: remove unneeded assignment of EPecma to vc_privGravatar Jiri Slaby (SUSE) 1-3/+2
vc_data::vc_priv is _always_ assigned before the ESgetpars case is entered (in ESsquare). Therefore, there is no need to reset it when leaving the ESgetpars case. Note the state is set to ESnormal few lines above, so ESgetpars is entered only by the next CSI. Therefore, this obfuscation can be removed. Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org> Link: https://lore.kernel.org/r/20240202065608.14019-6-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-02-06tty: vt: split DEC CSI+h/l handling into csi_DEC_hl()Gravatar Jiri Slaby (SUSE) 1-67/+77
The DEC and ECMA handling of CSI+h/l is needlessly complicated. Split these two, so that DEC is handled when the state is EPdec ('CSI ?' was seen) and ECMA is handled in the EPecma state (no '?'). Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org> Link: https://lore.kernel.org/r/20240202065608.14019-5-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-02-06tty: vt: rename set_mode() to csi_hl()Gravatar Jiri Slaby (SUSE) 1-3/+3
It's how the other CSI handling functions are named, so unify to that. Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org> Link: https://lore.kernel.org/r/20240202065608.14019-4-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-02-06tty: vt: define enums for CSI+h/l codesGravatar Jiri Slaby (SUSE) 1-12/+30
Decrypt the constant values by proper enum names. This time in set_mode(). Define two of them as DEC ('CSI ?') is about to be split away in the next patches. Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org> Link: https://lore.kernel.org/r/20240202065608.14019-3-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-02-06tty: vt: make rgb_from_256() slighly more comprehensibleGravatar Jiri Slaby (SUSE) 1-4/+7
* make the parameter unsigned, as it is expected to be unsigned, * make the computation easier to follow -- step-by-step, and * don't use 85 / 2 which is only a reduced form of 255 / 6 (by a factor 3). Unlike the former, the latter can be understood. Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org> Link: https://lore.kernel.org/r/20240202065608.14019-2-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-02-06serial: core: make serial_base_bus_type constGravatar Ricardo B. Marliere 1-1/+1
Now that the driver core can properly handle constant struct bus_type, move the serial_base_bus_type variable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime. Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: "Ricardo B. Marliere" <ricardo@marliere.net> Link: https://lore.kernel.org/r/20240203-bus_cleanup-tty-v1-2-86b698c82efe@marliere.net Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-02-06serdev: make serdev_bus_type constGravatar Ricardo B. Marliere 1-1/+1
Now that the driver core can properly handle constant struct bus_type, move the serdev_bus_type variable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime. Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: "Ricardo B. Marliere" <ricardo@marliere.net> Link: https://lore.kernel.org/r/20240203-bus_cleanup-tty-v1-1-86b698c82efe@marliere.net Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-02-06tty: serial: samsung: Remove superfluous braces in macroGravatar Sam Protsenko 1-4/+4
Commit 59f37b7370ef ("tty: serial: samsung: Remove USI initialization") removes parameters from EXYNOS_COMMON_SERIAL_DRV_DATA() macro, but leaves unnecessary empty braces. Remove those to fix the style. No functional change. Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20240202010507.22638-1-semen.protsenko@linaro.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>