[PATCH v4 1/5] clk: ast2600: allow empty entries in aspeed_g6_gates

Joel Stanley joel at jms.id.au
Wed Mar 1 11:50:24 AEDT 2023


On Tue, 28 Feb 2023 at 09:16, Jeremy Kerr <jk at codeconstruct.com.au> wrote:
>
> We're about to remove an entry from aspeed_g6_gates, but we won't want
> to alter/reorder existing entries. Allow empty entries in this array.

Nice. So it's recorded somewhere: the gates array should be
sequential, with the include/dt-bindings/clock/ast2600-clock.h defines
starting at 0 and counting up. If a clock gets mistakenly added and
needs to be removed, we can't have a "hole" in the array so instead we
leave it NULL and skip over adding it.

We could simply remove the bad entry but this would break the
theoretical case of a device tree with an old header, so we leave the
gaps in place :(

Reviewed-by: Joel Stanley <joel at jms.id.au>

Cheers,

Joel




>
> Signed-off-by: Jeremy Kerr <jk at codeconstruct.com.au>
>
> ---
> v3:
>  - reword commit message
> ---
>  drivers/clk/clk-ast2600.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/clk/clk-ast2600.c b/drivers/clk/clk-ast2600.c
> index 9c3305bcb27a..1f08ff3c60fa 100644
> --- a/drivers/clk/clk-ast2600.c
> +++ b/drivers/clk/clk-ast2600.c
> @@ -652,6 +652,9 @@ static int aspeed_g6_clk_probe(struct platform_device *pdev)
>                 const struct aspeed_gate_data *gd = &aspeed_g6_gates[i];
>                 u32 gate_flags;
>
> +               if (!gd->name)
> +                       continue;
> +
>                 /*
>                  * Special case: the USB port 1 clock (bit 14) is always
>                  * working the opposite way from the other ones.
> --
> 2.39.1
>


More information about the Linux-aspeed mailing list