Re: [PATCH v3 2/2] serial: core: Don't clobber the baud rate on hangup via B0

From: Maciej W. Rozycki

Date: Wed Nov 04 2026 - 20:12:09 EST


On Wed, 4 Nov 2026, Andy Shevchenko wrote:

> > In the unlikely case `port->hup_speed' is zero where the B0 rate has
> > been requested as the first one since the system boot for a non-console
> > device, resort to the current default of max(min, 9600).
>
> All lines above (except the last ones in the paragraphs) have a single trailing
> white space. Usually checkpatch warns at this.

I've always had that and in probably decades now (I can't recall when it
was first introduced) I haven't ever seen checkpatch complain about it,
and `git am' swallows it all anyway. Tools have been prepared. :)

> > /**
> > - * uart_get_baud_rate - return baud rate for a particular port
> > + * uart_get_baud_rate_save - return baud rate for a particular port
>
> Now it also saves it, so
>
> * uart_get_baud_rate_save - return and save baud rate for a particular port

Well, optionally, but since we still have uart_get_baud_rate() too, I'll
send an update along with v4 so that we don't have two functions with an
identical summary.

> > if (baud == 0)
> > - baud = max(min, 9600);
> > + baud = (port->hup_speed ?
> > + port->hup_speed : max(min, 9600));
>
> Outer parentheses are redundant. Also use Elvis.

I have double-checked it with our coding style document and I can see no
recommendation either way. FWIW I find it more readable this way, though
it might be habitual owing to another coding style I use where this is
actually required.

Any second opinions, anyone?

Thank you for your review.

Maciej