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

Andy Shevchenko andriy.shevchenko at linux.intel.com
Tue Apr 28 03:58:52 PDT 2026


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





More information about the linux-riscv mailing list