Thread (46 messages) 46 messages, 4 authors, 2025-08-04

Re: [PATCH v3 05/27] clk: mediatek: clk-mux: Add ops for mux gates with HW voter and FENC

From: Krzysztof Kozlowski <krzk@kernel.org>
Date: 2025-08-04 14:05:41
Also in: linux-arm-kernel, linux-clk, linux-devicetree, linux-mediatek, lkml

On 30/07/2025 12:56, Laura Nao wrote:
quoted hunk ↗ jump to hunk
 
 	clk_mux->regmap = regmap;
+	clk_mux->regmap_hwv = regmap_hwv;
 	clk_mux->data = mux;
 	clk_mux->lock = lock;
 	clk_mux->hw.init = &init;
@@ -268,6 +329,7 @@ int mtk_clk_register_muxes(struct device *dev,
 			   struct clk_hw_onecell_data *clk_data)
 {
 	struct regmap *regmap;
+	struct regmap *regmap_hwv;
 	struct clk_hw *hw;
 	int i;
 
@@ -277,6 +339,13 @@ int mtk_clk_register_muxes(struct device *dev,
 		return PTR_ERR(regmap);
 	}
 
+	regmap_hwv = mtk_clk_get_hwv_regmap(node);
+	if (IS_ERR(regmap_hwv)) {
This is either buggy or fragile. mtk_clk_get_hwv_regmap() returns NULL
or valid pointer... or error? IS_ERR_OR_NULL is not the wait to go.

Choose one - IS_ERR or NULL, preferrably the first, since you must
handle deferred probe.
quoted hunk ↗ jump to hunk
+		pr_err("Cannot find hardware voter regmap for %pOF: %pe\n",
+		       node, regmap_hwv);
+		return PTR_ERR(regmap_hwv);
+	}
+
 	for (i = 0; i < num; i++) {
 		const struct mtk_mux *mux = &muxes[i];
 
@@ -286,7 +355,7 @@ int mtk_clk_register_muxes(struct device *dev,
 			continue;
 		}
 
-		hw = mtk_clk_register_mux(dev, mux, regmap, lock);
+		hw = mtk_clk_register_mux(dev, mux, regmap, regmap_hwv, lock);
So NULL is passed and stored... are you sure this is 100% backwards
compatible?



Best regards,
Krzysztof
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help