[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZllZw3g8pF82lf8D@tlindgre-MOBL1>
Date: Fri, 31 May 2024 08:01:55 +0300
From: Tony Lindgren <tony.lindgren@...ux.intel.com>
To: Douglas Anderson <dianders@...omium.org>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jiri Slaby <jirislaby@...nel.org>,
Johan Hovold <johan+linaro@...nel.org>,
Yicong Yang <yangyicong@...ilicon.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Uwe Kleine-König <u.kleine-koenig@...gutronix.de>,
John Ogness <john.ogness@...utronix.de>,
linux-arm-msm@...r.kernel.org, Tony Lindgren <tony@...mide.com>,
Guanbing Huang <albanhuang@...cent.com>,
Thomas Gleixner <tglx@...utronix.de>, linux-kernel@...r.kernel.org,
linux-serial@...r.kernel.org
Subject: Re: [PATCH v2] serial: port: Don't block system suspend even if
bytes are left to xmit
On Thu, May 30, 2024 at 08:48:46AM -0700, Douglas Anderson wrote:
> The DEFINE_RUNTIME_DEV_PM_OPS() used by the serial_port code means
> that the system suspend function will be pm_runtime_force_suspend().
> In pm_runtime_force_suspend() we can see that before calling the
> runtime suspend function we'll call pm_runtime_disable(). This should
> be a reliable way to detect that we're called from system suspend and
> that we shouldn't look for busyness.
OK makes sense, one comment below though.
> --- a/drivers/tty/serial/serial_port.c
> +++ b/drivers/tty/serial/serial_port.c
> @@ -64,6 +64,16 @@ static int serial_port_runtime_suspend(struct device *dev)
> if (port->flags & UPF_DEAD)
> return 0;
>
> + /*
> + * We only want to check the busyness of the port if runtime PM is
> + * enabled. Specifically runtime PM will be disabled by
> + * pm_runtime_force_suspend() during system suspend and we don't want
> + * to block system suspend even if there is data still left to
> + * transmit. We only want to block regular runtime PM transitions.
> + */
> + if (!pm_runtime_enabled(dev))
> + return 0;
> +
How about change the comment a bit to describe why this happens so it's
easy to remember the next time looking at the code. I'd suggest just
something like this:
Nothing to do on pm_runtime_force_suspend(), see DEFINE_RUNTIME_DEV_PM_OPS
Other than that:
Reviewed-by: Tony Lindgren <tony.lindgren@...ux.intel.com>
Powered by blists - more mailing lists