public inbox for linux-serial@vger.kernel.org
 help / color / mirror / Atom feed
From: Tony Lindgren <tony.lindgren@linux.intel.com>
To: Douglas Anderson <dianders@chromium.org>
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Jiri Slaby" <jirislaby@kernel.org>,
	"Johan Hovold" <johan+linaro@kernel.org>,
	"Yicong Yang" <yangyicong@hisilicon.com>,
	"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"John Ogness" <john.ogness@linutronix.de>,
	linux-arm-msm@vger.kernel.org, "Tony Lindgren" <tony@atomide.com>,
	"Guanbing Huang" <albanhuang@tencent.com>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org
Subject: Re: [PATCH v2] serial: port: Don't block system suspend even if bytes are left to xmit
Date: Fri, 31 May 2024 08:01:55 +0300	[thread overview]
Message-ID: <ZllZw3g8pF82lf8D@tlindgre-MOBL1> (raw)
In-Reply-To: <20240530084841.v2.1.I2395e66cf70c6e67d774c56943825c289b9c13e4@changeid>

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@linux.intel.com>

  reply	other threads:[~2024-05-31  5:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-30 15:48 [PATCH v2] serial: port: Don't block system suspend even if bytes are left to xmit Douglas Anderson
2024-05-31  5:01 ` Tony Lindgren [this message]
2024-05-31  5:21 ` Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZllZw3g8pF82lf8D@tlindgre-MOBL1 \
    --to=tony.lindgren@linux.intel.com \
    --cc=albanhuang@tencent.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=dianders@chromium.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=johan+linaro@kernel.org \
    --cc=john.ogness@linutronix.de \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=tony@atomide.com \
    --cc=u.kleine-koenig@pengutronix.de \
    --cc=yangyicong@hisilicon.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox