Re: [PATCH v5 2/4] serial: 8250_dw: build Renesas RZN1 CPR value from DW_UART_CPR_* definitions

Andy Shevchenko
2026-04-28T10:58:58Z

On Tue, Apr 28, 2026 at 05:07:49PM +0800, Jia Wang wrote:
> On 2026-04-28 11:41 +0300, Ilpo Järvinen wrote:
> > On Tue, 28 Apr 2026, Andy Shevchenko wrote:
> > > On Tue, Apr 28, 2026 at 01:26:27PM +0800, Jia Wang wrote:

...

> > #define DW_UART_CPR_FIFO_MODE_FROM_SIZE(size) \
> > ({ \
> > typeof (size) __size = size; \
> > \
> > static_assert(IS_ALIGNED((__size), 16)); \
> > static_assert(__size <= DW_UART_CPR_FIFO_MODE_MAX); \
> > \
> > FIELD_PREP_CONST(DW_UART_CPR_FIFO_MODE, __size / 16); \
> > })
>
> Thanks. I tried that approach, but the statement-expression form does
> not work in this case because the helper is used in static initializers.
> So I'll keep it as a plain expression macro for now, and just rework it
> into a cleaner multi-line form.

Still you can move FIELD_PREP_CONST() into it.

--
With Best Regards,
Andy Shevchenko