RE: [PATCH v2 2/2] serial: rsci: Remove goto and refactor baud rate clock selection

From: Biju Das

Date: Wed Apr 08 2026 - 12:09:00 EST


Hi Geert,

> -----Original Message-----
> From: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
> Sent: 08 April 2026 16:53
> Subject: Re: [PATCH v2 2/2] serial: rsci: Remove goto and refactor baud rate clock selection
>
> Hi Biju,
>
> On Wed, 8 Apr 2026 at 17:45, Geert Uytterhoeven <geert@xxxxxxxxxxxxxx> wrote:
> > On Wed, 8 Apr 2026 at 16:21, Biju <biju.das.au@xxxxxxxxx> wrote:
> > > From: Biju Das <biju.das.jz@xxxxxxxxxxxxxx>
> > >
> > > Replace the goto done pattern in rsci_set_termios() with a positive
> > > conditional block. When baud rate is zero, the clock selection logic
> > > is now simply skipped rather than jumping to a 'done' label,
> > > eliminating the goto entirely.
> > >
> > > Since RSCI only uses a single clock source (SCI_FCK), the
> > > multi-clock tracking variables (best_clk, min_err, brr1, srr1, cks1)
> > > are redundant and removed. ccr0_val and ccr4_val are likewise
> > > dropped, replaced with hardcoded 0 at their write sites, as they
> > > were never modified from their initial zero values.
> > >
> > > No functional change intended.
> > >
> > > Reported-by: Pavel Machek <pavel@xxxxxxxxxxxx>
> > > Closes: https://lore.kernel.org/all/abPpZULsXhRmXTX9@xxxxxxxxxx/
> > > Signed-off-by: Biju Das <biju.das.jz@xxxxxxxxxxxxxx>
> > > ---
> > > v1->v2:
> > > * Dropped the check (abs(err) < abs(min_err) as it is always true.
> > > * Dropped the check (abs(err) < abs(min_err) as it is always true.
> > > * Dropped variables best_clk and min_err as they are no longer needed.
> > > * Dropped intermediate variables brr1, cks1 and srr1; results are now
> > > written directly into brr, cks and srr.
> > > * Moved dev_dbg() inside the if (baud) block.
> > > * Dropped ccr0_val and ccr4_val, replaced with hardcoded 0 at their
> > > write sites, as they were never modified from their initial values.
> > > * Scoped variables err and srr locally within the if (baud) block.
> > > * Updated commit description.
> >
> > Reviewed-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>
>
> I spoke too soon, you need one more change to make it build:
>
> --- a/drivers/tty/serial/rsci.c
> +++ b/drivers/tty/serial/rsci.c
> @@ -308,8 +308,7 @@ static void rsci_set_termios(struct uart_port *port, struct ktermios *termios,
> rsci_serial_out(port, CFCLR, CFCLR_CLRFLAG);
> rsci_serial_out(port, FFCLR, FFCLR_DRC);
>
> - ccr0_val |= CCR0_RE;
> - rsci_serial_out(port, CCR0, ccr0_val);
> + rsci_serial_out(port, CCR0, CCR0_RE);

Oops, I missed this.

Cheers,
Biju