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

From: Greg Kroah-Hartman

Date: Wed Nov 04 2026 - 06:53:09 EST


On Wed, Nov 04, 2026 at 12:28:22PM +0100, Johan Hovold wrote:
> On Wed, Nov 04, 2026 at 01:10:18PM +0200, Andy Shevchenko wrote:
> > On Tue, Nov 03, 2026 at 10:07:58PM +0000, Maciej W. Rozycki wrote:
>
> > > if (baud == 0)
> > > - baud = max(min, 9600);
> > > + baud = (port->hup_speed ?
> > > + port->hup_speed : max(min, 9600));
> >
> > Outer parentheses are redundant. Also use Elvis.
> >
> > baud = port->hup_speed ?: max(min, 9600);
>
> No, don't.
>
> Don't use the ternary operator at all as it tends to make code less
> readable.

I strongly endorse this. Write code for people first, compilers second.
? : is not friendly for people.

thanks,

greg k-h