linux-stable/drivers/tty/serial
Hugo Villeneuve 4739a8a989 serial: sc16is7xx: fix unconditional activation of THRI interrupt
[ Upstream commit 9915753037 ]

Commit cc4c1d05eb ("sc16is7xx: Properly resume TX after stop") changed
behavior to unconditionnaly set the THRI interrupt in sc16is7xx_tx_proc().

For example when sending a 65 bytes message, and assuming the Tx FIFO is
initially empty, sc16is7xx_handle_tx() will write the first 64 bytes of the
message to the FIFO and sc16is7xx_tx_proc() will then activate THRI. When
the THRI IRQ is fired, the driver will write the remaining byte of the
message to the FIFO, and disable THRI by calling sc16is7xx_stop_tx().

When sending a 2 bytes message, sc16is7xx_handle_tx() will write the 2
bytes of the message to the FIFO and call sc16is7xx_stop_tx(), disabling
THRI. After sc16is7xx_handle_tx() exits, control returns to
sc16is7xx_tx_proc() which will unconditionally set THRI. When the THRI IRQ
is fired, the driver simply acknowledges the interrupt and does nothing
more, since all the data has already been written to the FIFO. This results
in 2 register writes and 4 register reads all for nothing and taking
precious cycles from the I2C/SPI bus.

Fix this by enabling the THRI interrupt only when we fill the Tx FIFO to
its maximum capacity and there are remaining bytes to send in the message.

Fixes: cc4c1d05eb ("sc16is7xx: Properly resume TX after stop")
Cc:  <stable@vger.kernel.org>
Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
Link: https://lore.kernel.org/r/20231211171353.2901416-7-hugo@hugovil.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-01-31 16:19:10 -08:00
..
8250 serial: 8250: omap: Don't skip resource freeing if pm_runtime_resume_and_get() failed 2024-01-25 15:35:50 -08:00
jsm
21285.c serial: drivers: switch ch and flag to u8 2023-07-25 19:21:04 +02:00
altera_jtaguart.c serial: altera_jtaguart: switch status to u32 2023-07-31 17:16:05 +02:00
altera_uart.c serial: drivers: switch ch and flag to u8 2023-07-25 19:21:04 +02:00
amba-pl010.c serial: drivers: switch ch and flag to u8 2023-07-25 19:21:04 +02:00
amba-pl011.c ARM: PL011: Fix DMA support 2023-12-13 18:45:32 +01:00
apbuart.c serial: apbuart: fix console prompt on qemu 2024-01-25 15:35:55 -08:00
apbuart.h
ar933x_uart.c serial: ar933x: Use devm_platform_get_and_ioremap_resource() 2023-07-25 20:25:52 +02:00
arc_uart.c serial: drivers: switch ch and flag to u8 2023-07-25 19:21:04 +02:00
atmel_serial.c tty: Explicitly include correct DT includes 2023-07-25 20:19:05 +02:00
atmel_serial.h
bcm63xx_uart.c serial: bcm63xx-uart: Use devm_platform_get_and_ioremap_resource() 2023-07-25 20:25:52 +02:00
clps711x.c serial: clps711x: Use devm_platform_get_and_ioremap_resource() 2023-07-25 20:25:52 +02:00
cpm_uart.c serial: cpm_uart: Remove cpm_uart/ subdirectory 2023-08-04 15:08:30 +02:00
cpm_uart.h serial: cpm_uart: Remove cpm_uart/ subdirectory 2023-08-04 15:08:30 +02:00
digicolor-usart.c serial: drivers: switch ch and flag to u8 2023-07-25 19:21:04 +02:00
dz.c serial: drivers: switch ch and flag to u8 2023-07-25 19:21:04 +02:00
dz.h
earlycon-riscv-sbi.c
earlycon-semihost.c serial: Rename earlycon semihost driver 2023-01-19 14:58:19 +01:00
earlycon.c earlycon: Let users set the clock frequency 2023-01-19 14:56:44 +01:00
fsl_linflexuart.c serial: linflexuart: Use devm_platform_get_and_ioremap_resource() 2023-07-25 20:25:52 +02:00
fsl_lpuart.c Merge commit b320441c04 ("Merge tag 'tty-6.5-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty") into tty-next 2023-08-20 14:29:37 +02:00
icom.c
imx.c serial: Do not hold the port lock when setting rx-during-tx GPIO 2024-01-31 16:18:58 -08:00
imx_earlycon.c
ip22zilog.c serial: drivers: switch ch and flag to u8 2023-07-25 19:21:04 +02:00
ip22zilog.h
Kconfig TTY/Serial driver updates for 6.5-rc1. 2023-07-03 13:14:58 -07:00
kgdb_nmi.c tty: make tty_operations::write()'s count size_t 2023-08-11 21:12:46 +02:00
kgdboc.c tty: serial: kgdboc: fix mutex locking order for configure_kgdboc() 2023-01-16 16:44:53 +01:00
lantiq.c tty: Explicitly include correct DT includes 2023-07-25 20:19:05 +02:00
liteuart.c tty: Explicitly include correct DT includes 2023-07-25 20:19:05 +02:00
lpc32xx_hs.c
ma35d1_serial.c serial: ma35d1: Validate console index before assignment 2023-12-13 18:45:31 +01:00
Makefile serial: cpm_uart: Remove cpm_uart/ subdirectory 2023-08-04 15:08:30 +02:00
max310x.c serial: max310x: fix typos in comments 2023-08-04 15:08:09 +02:00
max3100.c serial: drivers: switch ch and flag to u8 2023-07-25 19:21:04 +02:00
mcf.c serial: drivers: switch ch and flag to u8 2023-07-25 19:21:04 +02:00
men_z135_uart.c serial: men_z135_uart: Use uart_xmit_advance() 2022-11-03 03:35:41 +01:00
meson_uart.c tty: serial: meson: fix hard LOCKUP on crtscts mode 2023-11-28 17:19:57 +00:00
milbeaut_usio.c serial: drivers: switch ch and flag to u8 2023-07-25 19:21:04 +02:00
mpc52xx_uart.c tty: Explicitly include correct DT includes 2023-07-25 20:19:05 +02:00
mps2-uart.c serial: mps2-uart: Use devm_platform_get_and_ioremap_resource() 2023-07-25 20:26:06 +02:00
msm_serial.c serial: msm: add lock annotation to msm_set_baud_rate() 2023-01-19 15:53:09 +01:00
mux.c
mvebu-uart.c serial: mvebu-uart: Use devm_platform_get_and_ioremap_resource() 2023-07-25 20:26:07 +02:00
mxs-auart.c tty: Explicitly include correct DT includes 2023-07-25 20:19:05 +02:00
omap-serial.c serial: omap: do not override settings for RS485 support 2024-01-25 15:35:44 -08:00
owl-uart.c
pch_uart.c tty: pcn_uart: fix memory leak with using debugfs_lookup() 2023-02-08 13:09:55 +01:00
pic32_uart.c tty: Explicitly include correct DT includes 2023-07-25 20:19:05 +02:00
pmac_zilog.c serial: pmac_zilog: Use uart_xmit_advance() 2022-11-03 03:35:42 +01:00
pmac_zilog.h
pxa.c serial: drivers: switch ch and flag to u8 2023-07-25 19:21:04 +02:00
qcom_geni_serial.c tty: serial: qcom-geni-serial: Poll primary sequencer irq status after cancel_tx 2023-08-09 14:15:28 +02:00
rda-uart.c serial: rda: Use uart_xmit_advance() 2022-11-03 03:35:42 +01:00
rp2.c serial: drivers: switch ch and flag to u8 2023-07-25 19:21:04 +02:00
sa1100.c serial: drivers: switch ch and flag to u8 2023-07-25 19:21:04 +02:00
samsung_tty.c tty: serial: samsung: Set missing PM ops for hibernation support 2023-08-04 15:06:24 +02:00
sb1250-duart.c serial: drivers: switch ch and flag to u8 2023-07-25 19:21:04 +02:00
sc16is7xx.c serial: sc16is7xx: fix unconditional activation of THRI interrupt 2024-01-31 16:19:10 -08:00
sccnxp.c serial: sccnxp: Use devm_platform_get_and_ioremap_resource() 2023-07-25 20:26:07 +02:00
serial-tegra.c serial: tegra: handle clk prepare error in tegra_uart_hw_init() 2023-08-22 15:29:18 +02:00
serial_base.h serial: core: Fix serial core port id, including multiport devices 2023-08-11 21:19:22 +02:00
serial_base_bus.c serial: core: Fix serial core port id, including multiport devices 2023-08-11 21:19:22 +02:00
serial_core.c serial: Do not hold the port lock when setting rx-during-tx GPIO 2024-01-31 16:18:58 -08:00
serial_ctrl.c serial: core: Start managing serial controllers to enable runtime PM 2023-05-31 10:46:59 +01:00
serial_mctrl_gpio.c
serial_mctrl_gpio.h
serial_port.c serial: core: Start managing serial controllers to enable runtime PM 2023-05-31 10:46:59 +01:00
serial_txx9.c serial: drivers: switch ch and flag to u8 2023-07-25 19:21:04 +02:00
sh-sci.c Merge 6.5-rc4 into tty-next 2023-07-31 09:39:56 +02:00
sh-sci.h tty: serial: sh-sci: Add support for tx end interrupt handling 2023-04-20 13:47:33 +02:00
sifive.c serial: sifive: Add suspend and resume operations 2023-08-22 15:29:10 +02:00
sprd_serial.c serial: sprd: Fix DMA buffer leak issue 2023-07-30 13:53:55 +02:00
st-asc.c drivers:tty: fix return value check in asc_init_port 2023-07-30 13:53:19 +02:00
stm32-usart.c serial: Do not hold the port lock when setting rx-during-tx GPIO 2024-01-31 16:18:58 -08:00
stm32-usart.h serial: stm32: group dma pause/resume error handling into single function 2023-08-22 15:28:51 +02:00
suncore.c
sunhv.c tty: Explicitly include correct DT includes 2023-07-25 20:19:05 +02:00
sunplus-uart.c serial: drivers: switch ch and flag to u8 2023-07-25 19:21:04 +02:00
sunsab.c tty: Explicitly include correct DT includes 2023-07-25 20:19:05 +02:00
sunsab.h
sunsu.c tty: Explicitly include correct DT includes 2023-07-25 20:19:05 +02:00
sunzilog.c tty: Explicitly include correct DT includes 2023-07-25 20:19:05 +02:00
sunzilog.h
tegra-tcu.c tty: Explicitly include correct DT includes 2023-07-25 20:19:05 +02:00
timbuart.c serial: timbuart: Use uart_xmit_advance() 2022-11-03 03:35:43 +01:00
timbuart.h
uartlite.c tty: Explicitly include correct DT includes 2023-07-25 20:19:05 +02:00
ucc_uart.c serial: cpm_uart: Don't include fs_uart_pd.h when not needed 2023-08-04 15:08:55 +02:00
vt8500_serial.c serial: vt8500: Use devm_platform_get_and_ioremap_resource() 2023-07-25 20:26:06 +02:00
xilinx_uartps.c tty: serial: xilinx_uartps: Do not check for 0 return after calling platform_get_irq() 2023-08-04 15:06:01 +02:00
zs.c serial: drivers: switch ch and flag to u8 2023-07-25 19:21:04 +02:00
zs.h