Re: [PATCH v2 4/8] clk: qcom: apss-ipq6018: ipq5332: add safe source switch for a53pll

From: Stephen Boyd
Date: Thu Oct 12 2023 - 16:51:08 EST


Quoting Varadarajan Narayanan (2023-10-12 02:26:20)
> diff --git a/drivers/clk/qcom/apss-ipq6018.c b/drivers/clk/qcom/apss-ipq6018.c
> index 4e13a08..c05c2b2 100644
> --- a/drivers/clk/qcom/apss-ipq6018.c
> +++ b/drivers/clk/qcom/apss-ipq6018.c
> @@ -84,15 +87,63 @@ static const struct qcom_cc_desc apss_ipq6018_desc = {
> .num_clks = ARRAY_SIZE(apss_ipq6018_clks),
> };
>
> +static int cpu_clk_notifier_fn(struct notifier_block *nb, unsigned long action,
> + void *data)
> +{
> + struct clk_hw *hw;
> + u8 index;
> + int err;
> +
> + if (action == PRE_RATE_CHANGE)
> + index = P_GPLL0;
> + else if ((action == POST_RATE_CHANGE) || (action == ABORT_RATE_CHANGE))

This has too many parenthesis.

> + index = P_APSS_PLL_EARLY;
> + else
> + return 0;

Maybe 'return NOTIFY_OK' instead?

> +
> + hw = &apcs_alias0_clk_src.clkr.hw;
> + err = clk_rcg2_mux_closest_ops.set_parent(hw, index);
> +
> + return notifier_from_errno(err);
> +}
> +
> +static struct notifier_block cpu_clk_notifier = {

Instead of a static global can this be allocated with kzalloc?

> + .notifier_call = cpu_clk_notifier_fn,
> +};
> +
> static int apss_ipq6018_probe(struct platform_device *pdev)