[PATCH 5/7] clk: thead: th1520-ap: Add macro to define multiplexers with flags

Yao Zi ziyao at disroot.org
Mon Nov 24 19:25:48 PST 2025


On Mon, Nov 24, 2025 at 02:14:15PM -0800, Drew Fustini wrote:
> On Thu, Nov 20, 2025 at 01:14:14PM +0000, Yao Zi wrote:
> > The new macro, TH_CCU_MUX_FLAGS, extends TH_CCU_MUX macro by adding two
> > parameters to specify clock flags and multiplexer flags.
> > 
> > Signed-off-by: Yao Zi <ziyao at disroot.org>
> > ---
> >  drivers/clk/thead/clk-th1520-ap.c | 9 +++++++--
> >  1 file changed, 7 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/clk/thead/clk-th1520-ap.c b/drivers/clk/thead/clk-th1520-ap.c
> > index bf8e80c39a9e..79f001a047b2 100644
> > --- a/drivers/clk/thead/clk-th1520-ap.c
> > +++ b/drivers/clk/thead/clk-th1520-ap.c
> > @@ -101,17 +101,22 @@ struct ccu_pll {
> >  		.flags	= _flags,					\
> >  	}
> >  
> > -#define TH_CCU_MUX(_name, _parents, _shift, _width)			\
> > +#define TH_CCU_MUX_FLAGS(_name, _parents, _shift, _width, _flags,	\
> > +			 _mux_flags)					\
> >  	{								\
> >  		.mask		= GENMASK(_width - 1, 0),		\
> 
> checkpatch warns [1] about this line:
> 
> CHECK: Macro argument '_width' may be better as '(_width)' to avoid precedence issues
> 
> I noticed it in the patchwork CI results [2] but I think we can ignore
> that as this patch is not actually changing that line.

Agree. This is only a "CHECK"-level warning, and for these clock
definition macros, I don't think there's a chance that precedence
problem would happen since only literals are feed into _width.

Enclosing the parameter in parentheses also makes the code a little
messy. so I'd prefer to keep it as-is, too.

> Thanks,
> Drew

Regards,
Yao Zi

> [1] https://gist.github.com/linux-riscv-bot/a335020c99ef628bb38e0a4ea85e0c45
> [2] https://patchwork.kernel.org/project/linux-riscv/patch/20251120131416.26236-6-ziyao@disroot.org/
> 
> _______________________________________________
> linux-riscv mailing list
> linux-riscv at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv



More information about the linux-riscv mailing list