[PATCH v11 09/12] clk: zte: Introduce a driver for zx297520v3 top clocks
sashiko-bot at kernel.org
sashiko-bot at kernel.org
Tue Aug 25 14:38:37 PDT 2026
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Initialization of a struct field with a non-constant expression causes a build failure.
--
commit 1a225b76174b59d250ad8049b72f7978a9dca24b
Author: Stefan Dösinger <stefandoesinger at gmail.com>
clk: zte: Introduce a driver for zx297520v3 top clocks
This commit introduces a new clock driver for the ZTE zx297520v3 SoC.
It supports the configuration of basic core devices, PLLs, the AHB bus,
timers, and the USB controller.
> diff --git a/drivers/clk/zte/clk-zx297520v3.c b/drivers/clk/zte/clk-zx297520v3.c
> new file mode 100644
> index 0000000000000..504075590e6d2
> --- /dev/null
> +++ b/drivers/clk/zte/clk-zx297520v3.c
[ ... ]
> +static const struct zx_clock zx297520v3_top_clocks[] = {
[ ... ]
> + /*
> + * "g" is either for "general" or "gigahertz". The VCO runs at 1 GHz. Output clocks are 200,
> + * 100, 50, 25, ... MHz. It is used optionally by SDIO and QSPI and can drive a GPIO clock
> + * output for RMII, so it doesn't seem very general.
> + */
> + [ZX_CLK_GPLL] = PLL("gpll", clk_main, 0, 0x110, 0),
> +
> + /* osc26m division for clk_outX */
> + [ZX_CLK_OSC26M_D2] = FIXED_DIV("osc26m-d2", clk_main[0], 2),
[Severity: Low]
Will this result in a build failure? The C standard requires the initializer
for a static struct field to be a constant expression. Using the variable
clk_main[0], even though it is declared as const, might cause the compiler
to reject this non-constant expression during initialization.
[ ... ]
> + [ZX_CLK_TIMER_T17_DIV] = DIV("timer-t17-div", PARENT_ID(ZX_CLK_TIMER_T17_MUX),
> + 0x124, 0, 4),
> + [ZX_CLK_WDT_T18_DIV] = DIV("wdt-t18-div", PARENT_ID(ZX_CLK_WDT_T18_MUX),
> + 0x48, 8, 4),
> + [ZX_CLK_USIM1_DIV] = DIV("usim1-div", clk_unknown,
> + 0x48, 12, 1),
[Severity: Low]
Similarly, will using the clk_unknown struct variable here trigger the same
compilation error because it is not a constant expression?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260826-zx29clk-v11-0-f8ad59c6426c@gmail.com?part=9
More information about the linux-phy
mailing list