Skip to contentSkip to conversation

serial: 8250: omap: Move pm_runtime_get_sync

PATCH New Judith Mendez 1 participant 1 message Oct 31, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 serial: 8250: omap: Move pm_runtime_get_sync

From: Bin Liu <[email protected]>

Currently in omap_8250_shutdown, the dma->rx_running flag is set to zero in omap_8250_rx_dma_flush. Next pm_runtime_get_sync is called, which is a runtime resume call stack which can re-set the flag. When the call omap_8250_shutdown returns, the flag is expected to be UN-SET, but this is not the case. This is causing issues the next time UART is re-opened and omap_8250_rx_dma is called. Fix by moving pm_runtime_get_sync before the omap_8250_rx_dma_flush.

Fixes 0e31c8d173ab ("tty: serial: 8250_omap: add custom DMA-RX callback")
[Judith: Add commit message]

---
Issue seen on am335x devices so far [0].
The patch has been tested with sanity boot test on am335x EVM, am335x-boneblack and am57xx-beagle-x15.

Changes since v1 RESEND:
- Fix email header and commit description length
- Add fixes tag, add link [0], cc stable, add kevin's reviewed-by/tested-by's
- Separate patch from patch series [1]

[0] https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1365142/am3352-resume-from-standby-problem-with-kernel-6-1-46

Link to v1 RESEND:
[1] https://lore.kernel.org/linux-omap/[email protected]/

---
 drivers/tty/serial/8250/8250_omap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/tty/serial/8250/8250_omap.c +2 -2
index 88b58f44e4e97..0dd68bdbfbcf7 100644
@@ -776,12 +776,12 @@ static void omap_8250_shutdown(struct uart_port *port)
 	struct uart_8250_port *up = up_to_u8250p(port);
 	struct omap8250_priv *priv = port->private_data;
 
+	pm_runtime_get_sync(port->dev);
+
 	flush_work(&priv->qos_work);
 	if (up->dma)
 		omap_8250_rx_dma_flush(up);
 
-	pm_runtime_get_sync(port->dev);
-
 	serial_out(up, UART_OMAP_WER, 0);
 	if (priv->habit & UART_HAS_EFR2)
 		serial_out(up, UART_OMAP_EFR2, 0x0);
Signature · 1 line
2.47.0