Patch "serial: 8250_omap: Use force_suspend and resume for system suspend" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    serial: 8250_omap: Use force_suspend and resume for system suspend

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     serial-8250_omap-use-force_suspend-and-resume-for-sy.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit f5bd394c4b70f5c915d01a8ab74c27e934303ecb
Author: Tony Lindgren <tony@xxxxxxxxxxx>
Date:   Wed Jun 14 07:59:19 2023 +0300

    serial: 8250_omap: Use force_suspend and resume for system suspend
    
    [ Upstream commit 20a41a62618df85f3a2981008edec5cadd785e0a ]
    
    We should not rely on autosuspend timeout for system suspend. Instead,
    let's use force_suspend and force_resume functions. Otherwise the serial
    port controller device may not be idled on suspend.
    
    As we are doing a register write on suspend to configure the serial port,
    we still need to runtime PM resume the port on suspend.
    
    While at it, let's switch to pm_runtime_resume_and_get() and check for
    errors returned. And let's add the missing line break before return to the
    suspend function while at it.
    
    Fixes: 09d8b2bdbc5c ("serial: 8250: omap: Provide ability to enable/disable UART as wakeup source")
    Signed-off-by: Tony Lindgren <tony@xxxxxxxxxxx>
    Tested-by: Dhruva Gole <d-gole@xxxxxx>
    Message-ID: <20230614045922.4798-1-tony@xxxxxxxxxxx>
    Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c
index de0447c87846b..a6b374c026a87 100644
--- a/drivers/tty/serial/8250/8250_omap.c
+++ b/drivers/tty/serial/8250/8250_omap.c
@@ -1521,25 +1521,35 @@ static int omap8250_suspend(struct device *dev)
 {
 	struct omap8250_priv *priv = dev_get_drvdata(dev);
 	struct uart_8250_port *up = serial8250_get_port(priv->line);
+	int err;
 
 	serial8250_suspend_port(priv->line);
 
-	pm_runtime_get_sync(dev);
+	err = pm_runtime_resume_and_get(dev);
+	if (err)
+		return err;
 	if (!device_may_wakeup(dev))
 		priv->wer = 0;
 	serial_out(up, UART_OMAP_WER, priv->wer);
-	pm_runtime_mark_last_busy(dev);
-	pm_runtime_put_autosuspend(dev);
-
+	err = pm_runtime_force_suspend(dev);
 	flush_work(&priv->qos_work);
-	return 0;
+
+	return err;
 }
 
 static int omap8250_resume(struct device *dev)
 {
 	struct omap8250_priv *priv = dev_get_drvdata(dev);
+	int err;
 
+	err = pm_runtime_force_resume(dev);
+	if (err)
+		return err;
 	serial8250_resume_port(priv->line);
+	/* Paired with pm_runtime_resume_and_get() in omap8250_suspend() */
+	pm_runtime_mark_last_busy(dev);
+	pm_runtime_put_autosuspend(dev);
+
 	return 0;
 }
 #else



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux