Re: [PATCH v2 4/7] serial: qcom-geni: fix receiver enable

From: Johan Hovold
Date: Wed Oct 09 2024 - 10:17:24 EST


On Thu, Oct 03, 2024 at 01:10:47PM -0700, Doug Anderson wrote:
> On Tue, Oct 1, 2024 at 5:51 AM Johan Hovold <johan+linaro@xxxxxxxxxx> wrote:

> > @@ -1179,6 +1179,11 @@ static int qcom_geni_serial_startup(struct uart_port *uport)
> > if (ret)
> > return ret;
> > }
> > +
> > + uart_port_lock_irq(uport);
> > + qcom_geni_serial_start_rx(uport);
> > + uart_port_unlock_irq(uport);
>
> I _think_ you don't need the locking here. The documentation for the
> "startup" callback say:
>
> * Interrupts: globally disabled.

Heh, yeah, that comment dates back to 2002 and probably wasn't even
correct back then.

This function is called with the port mutex held (and interrupts
enabled), and I need to take the port lock to serialise against the
console code.

> Other than that, this looks reasonable to me. I seem to recall
> previous discussions where _someone_ was relying on the
> qcom_geni_serial_start_rx() at the end of termios for some reason
> (which always felt like a bad design), but I can't find those old
> discussions. I suspect that the fact that you've added the start_rx in
> startup() is what we needed.

Yeah, I tried to find a reason for why things were done this way, but it
was probably just copied from the vendor driver. The hardware doesn't
seem to require stopping rx in set_termios() (and tx is not stopped
anyway), which could otherwise have been a reason.

Johan