Re: [PATCH 2/5] serial: cpm_uart: Remove custom frame size calculation

From: Andy Shevchenko
Date: Fri Aug 26 2022 - 11:54:39 EST


On Thu, Aug 25, 2022 at 11:58 AM Ilpo Järvinen
<ilpo.jarvinen@xxxxxxxxxxxxxxx> wrote:
>
> The number of bits can be calculated using helpers in core, no need for
> the driver to do it on its own.
>
> The mode register is programmed with frame bits minus 1, rearrange the
> comments related to that "feature" closer to the actual write.

...

> + out_be16(&smcp->smc_smcmr, smcr_mk_clen(tty_get_frame_size(termios->c_cflag) - 1) |
> + cval | SMCMR_SM_UART | prev_mode);
> } else {
> out_be16(&pinfo->sccup->scc_genscc.scc_mrblr, pinfo->rx_fifosize);
> out_be16(&pinfo->sccup->scc_maxidl, maxidl);
> - out_be16(&sccp->scc_psmr, (sbits << 12) | scval);
> + out_be16(&sccp->scc_psmr, (UART_LCR_WLEN(tty_get_char_size(termios->c_cflag))
> + << 12) | scval);

Seems it's better to calc it beforehand in the temporary variable for
both branches of the conditional and fix a bit strange indentation
here.

> }


--
With Best Regards,
Andy Shevchenko