Re: [PATCH 4/4] clk: mediatek: mt8183: Add clk mux notifier for MFG mux

From: Stephen Boyd
Date: Sat May 21 2022 - 00:27:44 EST


Quoting Chen-Yu Tsai (2022-05-20 02:43:23)
> diff --git a/drivers/clk/mediatek/clk-mt8183.c b/drivers/clk/mediatek/clk-mt8183.c
> index 8a755fadebb5..afef3738396e 100644
> --- a/drivers/clk/mediatek/clk-mt8183.c
> +++ b/drivers/clk/mediatek/clk-mt8183.c
> @@ -1217,6 +1219,25 @@ static int clk_mt8183_top_probe(struct platform_device *pdev)
> mtk_clk_register_gates(node, top_clks, ARRAY_SIZE(top_clks),
> top_clk_data);
>
> + /* Register mux notifier for MFG mux */

This comment sort of indicates it should be another function for this
block called "register mfg mux notifier".

> + mfg_mux_nb = devm_kzalloc(&pdev->dev, sizeof(*mfg_mux_nb), GFP_KERNEL);
> + if (!mfg_mux_nb)
> + return -ENOMEM;
> +
> + for (i = 0; i < ARRAY_SIZE(top_muxes); i++)
> + if (top_muxes[i].id == CLK_TOP_MUX_MFG)
> + break;
> + if (i == ARRAY_SIZE(top_muxes))
> + return -EINVAL;
> +
> + mfg_mux_nb->mux = &top_muxes[i];
> + mfg_mux_nb->bypass_index = 0; // Bypass to 26M crystal

Use /* these types of comments */

> + ret = devm_mtk_clk_mux_notifier_register(&pdev->dev,
> + top_clk_data->hws[CLK_TOP_MUX_MFG]->clk,
> + mfg_mux_nb);
> + if (ret)
> + return ret;
> +
> return of_clk_add_hw_provider(node, of_clk_hw_onecell_get,