[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YUyXwJnmPhm1940B@atomide.com>
Date: Thu, 23 Sep 2021 18:05:36 +0300
From: Tony Lindgren <tony@...mide.com>
To: Johan Hovold <johan@...nel.org>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Andy Shevchenko <andriy.shevchenko@...el.com>,
Jiri Slaby <jirislaby@...nel.org>,
Vignesh Raghavendra <vigneshr@...com>,
linux-serial@...r.kernel.org, linux-omap@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 4/6] serial: 8250: Implement prep_tx for power management
* Johan Hovold <johan@...nel.org> [210923 12:50]:
> On Tue, Sep 21, 2021 at 01:33:44PM +0300, Tony Lindgren wrote:
> > +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?
Hmm yeah we should at pm_runtime_get() and pm_runtime_put() to write()
unless serial8250_rpm_get() and serial8250_rpm_put() are doing it.
Or pair prep with finish and deal with the usage count there.
Regards,
Tony
Powered by blists - more mailing lists