clk: mediatek: cpumux: Propagate struct device where possible
authorAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Fri, 20 Jan 2023 09:20:34 +0000 (10:20 +0100)
committerStephen Boyd <sboyd@kernel.org>
Tue, 31 Jan 2023 00:45:01 +0000 (16:45 -0800)
Take a pointer to a struct device in mtk_clk_register_cpumuxes() and
propagate the same to mtk_clk_register_cpumux() => clk_hw_register().
Even though runtime pm is unlikely to be used with CPU muxes, this
helps with code consistency and possibly opens to commonization of
some mtk_clk_register_(x) functions.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
Reviewed-by: Markus Schneider-Pargmann <msp@baylibre.com>
Tested-by: Miles Chen <miles.chen@mediatek.com>
Link: https://lore.kernel.org/r/20230120092053.182923-5-angelogioacchino.delregno@collabora.com
Tested-by: Mingming Su <mingming.su@mediatek.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
drivers/clk/mediatek/clk-cpumux.c
drivers/clk/mediatek/clk-cpumux.h
drivers/clk/mediatek/clk-mt2701.c
drivers/clk/mediatek/clk-mt6795-infracfg.c
drivers/clk/mediatek/clk-mt7622.c
drivers/clk/mediatek/clk-mt7629.c
drivers/clk/mediatek/clk-mt8173.c

index 25618eff6f2aa2b3193f69e6d9d6a605791c19b4..da05f06192c095dd32a8844f08d38a1b2b0c7a8d 100644 (file)
@@ -58,7 +58,7 @@ static const struct clk_ops clk_cpumux_ops = {
 };
 
 static struct clk_hw *
-mtk_clk_register_cpumux(const struct mtk_composite *mux,
+mtk_clk_register_cpumux(struct device *dev, const struct mtk_composite *mux,
                        struct regmap *regmap)
 {
        struct mtk_clk_cpumux *cpumux;
@@ -81,7 +81,7 @@ mtk_clk_register_cpumux(const struct mtk_composite *mux,
        cpumux->regmap = regmap;
        cpumux->hw.init = &init;
 
-       ret = clk_hw_register(NULL, &cpumux->hw);
+       ret = clk_hw_register(dev, &cpumux->hw);
        if (ret) {
                kfree(cpumux);
                return ERR_PTR(ret);
@@ -102,7 +102,7 @@ static void mtk_clk_unregister_cpumux(struct clk_hw *hw)
        kfree(cpumux);
 }
 
-int mtk_clk_register_cpumuxes(struct device_node *node,
+int mtk_clk_register_cpumuxes(struct device *dev, struct device_node *node,
                              const struct mtk_composite *clks, int num,
                              struct clk_hw_onecell_data *clk_data)
 {
@@ -125,7 +125,7 @@ int mtk_clk_register_cpumuxes(struct device_node *node,
                        continue;
                }
 
-               hw = mtk_clk_register_cpumux(mux, regmap);
+               hw = mtk_clk_register_cpumux(dev, mux, regmap);
                if (IS_ERR(hw)) {
                        pr_err("Failed to register clk %s: %pe\n", mux->name,
                               hw);
index 325adbef25d13a1c2f5c2f9ad5de0ca87f64d8e4..64e45c63b4a0d5fc47ce5296e1ac2d81e5b75983 100644 (file)
@@ -11,7 +11,7 @@ struct clk_hw_onecell_data;
 struct device_node;
 struct mtk_composite;
 
-int mtk_clk_register_cpumuxes(struct device_node *node,
+int mtk_clk_register_cpumuxes(struct device *dev, struct device_node *node,
                              const struct mtk_composite *clks, int num,
                              struct clk_hw_onecell_data *clk_data);
 
index 61f1f358104bd36b5551421c583937f563836f7d..3d56ab25aeac671b1d8c75c0caff1aec1a79de73 100644 (file)
@@ -769,7 +769,7 @@ static void __init mtk_infrasys_init_early(struct device_node *node)
        mtk_clk_register_factors(infra_fixed_divs, ARRAY_SIZE(infra_fixed_divs),
                                                infra_clk_data);
 
-       mtk_clk_register_cpumuxes(node, cpu_muxes, ARRAY_SIZE(cpu_muxes),
+       mtk_clk_register_cpumuxes(NULL, node, cpu_muxes, ARRAY_SIZE(cpu_muxes),
                                  infra_clk_data);
 
        r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get,
index 8025d171d6923585837cf3e840b2df571eeb4f08..23d9fc057e611f4f09ec79827af21f049522f48e 100644 (file)
@@ -106,7 +106,8 @@ static int clk_mt6795_infracfg_probe(struct platform_device *pdev)
        if (ret)
                goto free_clk_data;
 
-       ret = mtk_clk_register_cpumuxes(node, cpu_muxes, ARRAY_SIZE(cpu_muxes), clk_data);
+       ret = mtk_clk_register_cpumuxes(&pdev->dev, node, cpu_muxes,
+                                       ARRAY_SIZE(cpu_muxes), clk_data);
        if (ret)
                goto unregister_gates;
 
index 976f318c2e5ee3cbed13e875396a573bf3dcd787..a51a6ed9c4b82ec120f012cd7ab7e6e19ed67b26 100644 (file)
@@ -673,8 +673,8 @@ static int mtk_infrasys_init(struct platform_device *pdev)
        mtk_clk_register_gates(&pdev->dev, node, infra_clks,
                               ARRAY_SIZE(infra_clks), clk_data);
 
-       mtk_clk_register_cpumuxes(node, infra_muxes, ARRAY_SIZE(infra_muxes),
-                                 clk_data);
+       mtk_clk_register_cpumuxes(&pdev->dev, node, infra_muxes,
+                                 ARRAY_SIZE(infra_muxes), clk_data);
 
        r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get,
                                   clk_data);
index aadf5d1bc986a0a8fa2b62ec9dfab605f7c6bfa3..0fa158d61a296c110e3eacfe801cfc1253f210db 100644 (file)
@@ -608,8 +608,8 @@ static int mtk_infrasys_init(struct platform_device *pdev)
        mtk_clk_register_gates(&pdev->dev, node, infra_clks,
                               ARRAY_SIZE(infra_clks), clk_data);
 
-       mtk_clk_register_cpumuxes(node, infra_muxes, ARRAY_SIZE(infra_muxes),
-                                 clk_data);
+       mtk_clk_register_cpumuxes(&pdev->dev, node, infra_muxes,
+                                 ARRAY_SIZE(infra_muxes), clk_data);
 
        return of_clk_add_hw_provider(node, of_clk_hw_onecell_get,
                                      clk_data);
index c6545f9c759f1f183b29fc40d907b176571ac72d..767368463ec5e20aba882f882ed863ae04afa5cb 100644 (file)
@@ -892,8 +892,8 @@ static void __init mtk_infrasys_init(struct device_node *node)
                               ARRAY_SIZE(infra_clks), clk_data);
        mtk_clk_register_factors(infra_divs, ARRAY_SIZE(infra_divs), clk_data);
 
-       mtk_clk_register_cpumuxes(node, cpu_muxes, ARRAY_SIZE(cpu_muxes),
-                                 clk_data);
+       mtk_clk_register_cpumuxes(NULL, node, cpu_muxes,
+                                 ARRAY_SIZE(cpu_muxes), clk_data);
 
        r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
        if (r)