Re: [PATCH v2] serial: port: Don't suspend if the port is still busy

From: Tony Lindgren
Date: Tue Feb 06 2024 - 08:22:38 EST


* Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> [240206 13:12]:
> > static int serial_port_runtime_suspend(struct device *dev)
> > {
> > int ret;
> > ...
> > uart_port_lock_irqsave(port, &flags);
> > ret = __serial_port_busy(port);
> > if (ret)
> > port->ops->start_tx(port);
> > uart_port_unlock_irqrestore(port, flags);
>
> > if (ret)
> > pm_runtime_mark_last_busy(dev);
>
> And obvious question here: why in case of 0 we can't mark this as busy as well?
> I.o.w. why do we need to mark it only when error is set?

No need to call in the 0 case. The last time driver was busy
was when pm_runtime_mark_last_busy() was called, and in the 0 case
we just runtime suspend based on the autosuspend timeout value.

Regards,

Tony