linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Tony Lindgren <tony@atomide.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Andy Shevchenko <andriy.shevchenko@intel.com>,
	Jiri Slaby <jirislaby@kernel.org>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	linux-serial@vger.kernel.org, linux-omap@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/6] serial: 8250: Implement prep_tx for power management
Date: Thu, 23 Sep 2021 14:49:59 +0200	[thread overview]
Message-ID: <YUx399WBrMiZDhno@hovoldconsulting.com> (raw)
In-Reply-To: <20210921103346.64824-5-tony@atomide.com>

On Tue, Sep 21, 2021 at 01:33:44PM +0300, Tony Lindgren wrote:
> We can use the prep_tx() call to wake up an idle serial port. This allows
> ust to remove the depedency to pm_runtime_irq_safe() for 8250_omap driver
> in the following patches.
> 
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---
>  drivers/tty/serial/8250/8250_port.c | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
> 
> diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
> --- a/drivers/tty/serial/8250/8250_port.c
> +++ b/drivers/tty/serial/8250/8250_port.c
> @@ -1650,6 +1650,29 @@ static enum hrtimer_restart serial8250_em485_handle_start_tx(struct hrtimer *t)
>  	return HRTIMER_NORESTART;
>  }
>  
> +static int serial8250_prep_tx(struct uart_port *port)
> +{
> +	struct uart_8250_port *up = up_to_u8250p(port);
> +	struct device *dev = up->port.dev;
> +	int err;
> +
> +	if (!(up->capabilities & UART_CAP_RPM))
> +		return 0;
> +
> +	if (!pm_runtime_suspended(dev)) {
> +		pm_runtime_mark_last_busy(dev);
> +		return 0;
> +	}
> +
> +	err = pm_request_resume(dev);
> +	if (err < 0) {
> +		dev_warn(dev, "prep_tx wakeup failed: %d\n", err);
> +		return err;
> +	}

How is this supposed to work without a runtime PM usage-counter
increment? What's to prevent the port from suspending again while it's
transmitting?

> +
> +	return -EINPROGRESS;
> +}

Johan

  reply	other threads:[~2021-09-23 12:49 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-21 10:33 [PATCH 0/6] Get rid of pm_runtime_irq_safe() for 8250_omap Tony Lindgren
2021-09-21 10:33 ` [PATCH 1/6] n_tty: Start making use of -EAGAIN returned from process_output_block() Tony Lindgren
2021-09-21 11:58   ` Andy Shevchenko
2021-09-21 10:33 ` [PATCH 2/6] tty: n_gsm: Don't ignore write return value in gsmld_output() Tony Lindgren
2021-09-21 10:33 ` [PATCH 3/6] serial: core: Add new prep_tx for power management Tony Lindgren
2021-09-23 12:45   ` Johan Hovold
2021-09-23 15:02     ` Tony Lindgren
2021-09-24 14:37       ` Johan Hovold
2021-09-24 15:09         ` Tony Lindgren
2021-09-27 14:05           ` Johan Hovold
2021-09-21 10:33 ` [PATCH 4/6] serial: 8250: Implement " Tony Lindgren
2021-09-23 12:49   ` Johan Hovold [this message]
2021-09-23 15:05     ` Tony Lindgren
2021-09-24 14:44       ` Johan Hovold
2021-09-24 15:16         ` Tony Lindgren
2021-09-21 10:33 ` [PATCH 5/6] serial: 8250_omap: Require a valid wakeirq for deeper idle states Tony Lindgren
2021-09-21 10:33 ` [PATCH 6/6] serial: 8250_omap: Drop the use of pm_runtime_irq_safe() Tony Lindgren
2021-09-21 12:03 ` [PATCH 0/6] Get rid of pm_runtime_irq_safe() for 8250_omap Andy Shevchenko

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=YUx399WBrMiZDhno@hovoldconsulting.com \
    --to=johan@kernel.org \
    --cc=andriy.shevchenko@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=tony@atomide.com \
    --cc=vigneshr@ti.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;
as well as URLs for NNTP newsgroup(s).