Re: [PATCH 1/4] serial: core: Add wakeup() and start_pending_tx() for power management

Tony Lindgren
2021-10-15T09:13:48Z

* Greg Kroah-Hartman <gregkh@linuxfoundation.org> [211013 12:34]:
> On Thu, Sep 30, 2021 at 09:29:03AM +0300, Tony Lindgren wrote:
> > --- a/drivers/tty/serial/serial_core.c
> > +++ b/drivers/tty/serial/serial_core.c
> > @@ -91,6 +91,23 @@ static inline struct uart_port *uart_port_check(struct uart_state *state)
> > return state->uart_port;
> > }
> >
> > +/*
> > + * This routine can be used before register access to wake up a serial
> > + * port that has been runtime PM suspended by the serial port driver.
> > + * Note that the runtime_suspended flag is managed by the serial port
> > + * device driver runtime PM.
> > + */
> > +static int uart_port_wakeup(struct uart_port *port)
> > +{
> > + if (!atomic_read(&port->runtime_suspended))
> > + return 0;
>
> And if the value changes right after you read this?
>
> Why not use a real lock here? Don't use an atomic if you don't need it.

Yeah good point, we should just use port->lock.

Regards,

Tony