Skip to content

Commit 560706e

Browse files
tmlindgregkh
authored andcommitted
serial: 8250_omap: Fix errors with no_console_suspend
We now get errors on system suspend if no_console_suspend is set as reported by Thomas. The errors started with commit 20a41a6 ("serial: 8250_omap: Use force_suspend and resume for system suspend"). Let's fix the issue by checking for console_suspend_enabled in the system suspend and resume path. Note that with this fix the checks for console_suspend_enabled in omap8250_runtime_suspend() become useless. We now keep runtime PM usage count for an attached kernel console starting with commit bedb404 ("serial: 8250_port: Don't use power management for kernel console"). Fixes: 20a41a6 ("serial: 8250_omap: Use force_suspend and resume for system suspend") Cc: stable <stable@kernel.org> Cc: Udit Kumar <u-kumar1@ti.com> Reported-by: Thomas Richard <thomas.richard@bootlin.com> Signed-off-by: Tony Lindgren <tony@atomide.com> Tested-by: Thomas Richard <thomas.richard@bootlin.com> Reviewed-by: Dhruva Gole <d-gole@ti.com> Link: https://lore.kernel.org/r/20230926061319.15140-1-tony@atomide.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 8679328 commit 560706e

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

drivers/tty/serial/8250/8250_omap.c

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1617,7 +1617,7 @@ static int omap8250_suspend(struct device *dev)
16171617
{
16181618
struct omap8250_priv *priv = dev_get_drvdata(dev);
16191619
struct uart_8250_port *up = serial8250_get_port(priv->line);
1620-
int err;
1620+
int err = 0;
16211621

16221622
serial8250_suspend_port(priv->line);
16231623

@@ -1627,7 +1627,8 @@ static int omap8250_suspend(struct device *dev)
16271627
if (!device_may_wakeup(dev))
16281628
priv->wer = 0;
16291629
serial_out(up, UART_OMAP_WER, priv->wer);
1630-
err = pm_runtime_force_suspend(dev);
1630+
if (uart_console(&up->port) && console_suspend_enabled)
1631+
err = pm_runtime_force_suspend(dev);
16311632
flush_work(&priv->qos_work);
16321633

16331634
return err;
@@ -1636,11 +1637,15 @@ static int omap8250_suspend(struct device *dev)
16361637
static int omap8250_resume(struct device *dev)
16371638
{
16381639
struct omap8250_priv *priv = dev_get_drvdata(dev);
1640+
struct uart_8250_port *up = serial8250_get_port(priv->line);
16391641
int err;
16401642

1641-
err = pm_runtime_force_resume(dev);
1642-
if (err)
1643-
return err;
1643+
if (uart_console(&up->port) && console_suspend_enabled) {
1644+
err = pm_runtime_force_resume(dev);
1645+
if (err)
1646+
return err;
1647+
}
1648+
16441649
serial8250_resume_port(priv->line);
16451650
/* Paired with pm_runtime_resume_and_get() in omap8250_suspend() */
16461651
pm_runtime_mark_last_busy(dev);
@@ -1717,16 +1722,6 @@ static int omap8250_runtime_suspend(struct device *dev)
17171722

17181723
if (priv->line >= 0)
17191724
up = serial8250_get_port(priv->line);
1720-
/*
1721-
* When using 'no_console_suspend', the console UART must not be
1722-
* suspended. Since driver suspend is managed by runtime suspend,
1723-
* preventing runtime suspend (by returning error) will keep device
1724-
* active during suspend.
1725-
*/
1726-
if (priv->is_suspending && !console_suspend_enabled) {
1727-
if (up && uart_console(&up->port))
1728-
return -EBUSY;
1729-
}
17301725

17311726
if (priv->habit & UART_ERRATA_CLOCK_DISABLE) {
17321727
int ret;

0 commit comments

Comments
 (0)