[PATCH v8 09/12] clk: zte: Introduce a driver for zx297520v3 matrix clocks

sashiko-bot at kernel.org sashiko-bot at kernel.org
Mon Jul 27 12:41:34 PDT 2026


Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The use of `clk_main[0]` to initialize fields in static global arrays is invalid C and causes a compilation error.
--

--- Patch [9]: [PATCH v8 09/12] clk: zte: Introduce a driver for zx297520v3 matrix clocks ---
commit 895d095e9e21d84eaefefb2e2881a4f8193ef450
Author: Stefan Dösinger <stefandoesinger at gmail.com>

clk: zte: Introduce a driver for zx297520v3 matrix clocks

This commit introduces a new clock driver for the zx297520v3 matrix clock
controller, which manages high-speed devices such as CPU, DMA, RAM, SDIO,
and Ethernet. It registers multiplexers, fixed dividers, and gates within
the controller.

> diff --git a/drivers/clk/zte/clk-zx297520v3.c b/drivers/clk/zte/clk-zx297520v3.c
> index 4444c2eb13825..9299449097b4a 100644
> --- a/drivers/clk/zte/clk-zx297520v3.c
> +++ b/drivers/clk/zte/clk-zx297520v3.c
[ ... ]
> @@ -542,6 +542,340 @@ static const struct zx_clk_data zx297520v3_topclk_data = {
[ ... ]
> +static const struct zx_gate_desc zx297520v3_matrix_gates[] = {
[ ... ]
> +	/* Both 0x24 and 0x28 bits 1 and 2 stop the CPU. There is also a bit in topclk+0x138, which
> +	 * ZTE's uboot calls "A53 reset", which also stops the CPU. I can't really tell the
> +	 * difference between matrix+0x28 and top+0x138. The clock (matrix+0x24) can be disabled
> +	 * and enabled from the Cortex M0 and it will nicely stop and restart the A53, retaining
> +	 * all state.
> +	 */
> +	GATE(ZX297520V3_CPU_WCLK,          "cpu-wclk",       "cpu-mux",        0x24,  1,
> +	     CLK_IS_CRITICAL),
> +	GATE(ZX297520V3_CPU_PCLK,          "cpu-pclk",       clk_main[0],      0x24,  2,
> +	     CLK_IS_CRITICAL),

[Severity: Low]
Does this cause a compilation error? In C, static array initializers must
use constant expressions. Accessing an array element like clk_main[0] requires
reading memory, which is not considered a constant expression by the compiler,
and will likely result in an initializer element is not constant build error.

This pattern also appears in several other GATE definitions further down in
the zx297520v3_matrix_gates array.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260727-zx29clk-v8-0-7a107b00f1dd@gmail.com?part=9



More information about the linux-phy mailing list