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@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), \
.shift = _shift, \
+ .flags = _mux_flags, \
.hw.init = CLK_HW_INIT_PARENTS_DATA( \
_name, \
_parents, \
&clk_mux_ops, \
- 0), \
+ _flags), \
}
+#define TH_CCU_MUX(_name, _parents, _shift, _width) \
+ TH_CCU_MUX_FLAGS(_name, _parents, _shift, _width, 0, 0)
+
#define CCU_GATE(_clkid, _struct, _name, _parent, _reg, _bit, _flags) \
struct ccu_gate _struct = { \
.clkid = _clkid, \
--
2.51.2
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@disroot.org> > --- > drivers/clk/thead/clk-th1520-ap.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) Reviewed-by: Drew Fustini <fustini@kernel.org>
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@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.
Thanks,
Drew
[1] https://gist.github.com/linux-riscv-bot/a335020c99ef628bb38e0a4ea85e0c45
[2] https://patchwork.kernel.org/project/linux-riscv/patch/20251120131416.26236-6-ziyao@disroot.org/
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@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@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv
© 2016 - 2025 Red Hat, Inc.