mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/3] pmdomain: rockchip: probe error clean-ups
@ 2026-11-26 10:01 Arun Iyengar via B4 Relay
  2026-11-26 10:01 ` [PATCH 1/3] pmdomain: rockchip: keep the pm_qos regmap error code Arun Iyengar via B4 Relay
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-11-26 10:01 UTC (permalink / raw)
  To: Ulf Hansson, Heiko Stuebner, Shawn Lin, Sebastian Reichel
  Cc: linux-pm, linux-arm-kernel, linux-rockchip, linux-kernel, Yao Zi,
	Arun Iyengar

Keep the error code of a pm_qos syscon lookup, use dev_err_probe() in
the probe path, and report each domain error once.

Build-tested only.

Developed with Claude (Anthropic), which wrote the code and the commit
messages. I reviewed every change.

Split out of v3 of "pmdomain: rockchip: fix the probe error and
deferral paths" [1]; its fix goes separately to the fixes branch.

[1] https://lore.kernel.org/r/20261113-pmdomain-rockchip-v3-0-b7039ca30b87@gmail.com

Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
Changes since [1]:
- 1/3: the pm_qos part of v3 2/3, without Fixes tags
- 2/3: v3 3/3, also converting rockchip_pm_domain_probe()
- 3/3: the rest of v3 2/3, on top of Yao Zi's patch in next

---
Arun Iyengar (3):
      pmdomain: rockchip: keep the pm_qos regmap error code
      pmdomain: rockchip: use dev_err_probe() in the probe path
      pmdomain: rockchip: report domain errors where they happen

 drivers/pmdomain/rockchip/pm-domains.c | 122 ++++++++++++++-------------------
 1 file changed, 50 insertions(+), 72 deletions(-)
---
base-commit: e9a9fed57b72b811fbaf62673cf56727a3358899
change-id: 20261126-pmdomain-rockchip-cleanup-e067a69909bc

Best regards,
--  
Arun Iyengar <aiyengar1990@gmail.com>



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/3] pmdomain: rockchip: keep the pm_qos regmap error code
  2026-11-26 10:01 [PATCH 0/3] pmdomain: rockchip: probe error clean-ups Arun Iyengar via B4 Relay
@ 2026-11-26 10:01 ` Arun Iyengar via B4 Relay
  2026-11-26 10:01 ` [PATCH 2/3] pmdomain: rockchip: use dev_err_probe() in the probe path Arun Iyengar via B4 Relay
  2026-11-26 10:01 ` [PATCH 3/3] pmdomain: rockchip: report domain errors where they happen Arun Iyengar via B4 Relay
  2 siblings, 0 replies; 4+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-11-26 10:01 UTC (permalink / raw)
  To: Ulf Hansson, Heiko Stuebner, Shawn Lin, Sebastian Reichel
  Cc: linux-pm, linux-arm-kernel, linux-rockchip, linux-kernel, Yao Zi,
	Arun Iyengar

From: Arun Iyengar <aiyengar1990@gmail.com>

syscon_node_to_regmap() can return -EPROBE_DEFER. Turning that into
-ENODEV fails the probe instead of deferring it.

Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
 drivers/pmdomain/rockchip/pm-domains.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pmdomain/rockchip/pm-domains.c b/drivers/pmdomain/rockchip/pm-domains.c
index 17a6334b0b9f..b52bdf0e8a19 100644
--- a/drivers/pmdomain/rockchip/pm-domains.c
+++ b/drivers/pmdomain/rockchip/pm-domains.c
@@ -928,7 +928,7 @@ static int rockchip_pm_add_one_domain(struct rockchip_pmu *pmu,
 			pd->qos_regmap[j] = syscon_node_to_regmap(qos_node);
 			of_node_put(qos_node);
 			if (IS_ERR(pd->qos_regmap[j])) {
-				error = -ENODEV;
+				error = PTR_ERR(pd->qos_regmap[j]);
 				goto err_unprepare_clocks;
 			}
 		}

-- 
2.55.0



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/3] pmdomain: rockchip: use dev_err_probe() in the probe path
  2026-11-26 10:01 [PATCH 0/3] pmdomain: rockchip: probe error clean-ups Arun Iyengar via B4 Relay
  2026-11-26 10:01 ` [PATCH 1/3] pmdomain: rockchip: keep the pm_qos regmap error code Arun Iyengar via B4 Relay
@ 2026-11-26 10:01 ` Arun Iyengar via B4 Relay
  2026-11-26 10:01 ` [PATCH 3/3] pmdomain: rockchip: report domain errors where they happen Arun Iyengar via B4 Relay
  2 siblings, 0 replies; 4+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-11-26 10:01 UTC (permalink / raw)
  To: Ulf Hansson, Heiko Stuebner, Shawn Lin, Sebastian Reichel
  Cc: linux-pm, linux-arm-kernel, linux-rockchip, linux-kernel, Yao Zi,
	Arun Iyengar

From: Arun Iyengar <aiyengar1990@gmail.com>

Convert the dev_err() and return pairs in the probe path to
dev_err_probe(). The return values do not change.

Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
 drivers/pmdomain/rockchip/pm-domains.c | 82 ++++++++++++++--------------------
 1 file changed, 33 insertions(+), 49 deletions(-)

diff --git a/drivers/pmdomain/rockchip/pm-domains.c b/drivers/pmdomain/rockchip/pm-domains.c
index b52bdf0e8a19..9d5a79c6d4f9 100644
--- a/drivers/pmdomain/rockchip/pm-domains.c
+++ b/drivers/pmdomain/rockchip/pm-domains.c
@@ -842,28 +842,22 @@ static int rockchip_pm_add_one_domain(struct rockchip_pmu *pmu,
 	int error;
 
 	error = of_property_read_u32(node, "reg", &id);
-	if (error) {
-		dev_err(pmu->dev,
-			"%pOFn: failed to retrieve domain id (reg): %d\n",
-			node, error);
-		return -EINVAL;
-	}
+	if (error)
+		return dev_err_probe(pmu->dev, -EINVAL,
+				     "%pOFn: failed to retrieve domain id (reg)\n",
+				     node);
 
-	if (id >= pmu->info->num_domains) {
-		dev_err(pmu->dev, "%pOFn: invalid domain id %d\n",
-			node, id);
-		return -EINVAL;
-	}
+	if (id >= pmu->info->num_domains)
+		return dev_err_probe(pmu->dev, -EINVAL,
+				     "%pOFn: invalid domain id %d\n", node, id);
 	/* RK3588 has domains with two parents (RKVDEC0/RKVDEC1) */
 	if (pmu->genpd_data.domains[id])
 		return 0;
 
 	pd_info = &pmu->info->domain_info[id];
-	if (!pd_info->pwr_mask && !pd_info->req_mask) {
-		dev_err(pmu->dev, "%pOFn: undefined domain id %d\n",
-			node, id);
-		return -EINVAL;
-	}
+	if (!pd_info->pwr_mask && !pd_info->req_mask)
+		return dev_err_probe(pmu->dev, -EINVAL,
+				     "%pOFn: undefined domain id %d\n", node, id);
 
 	pd = devm_kzalloc_obj(pmu->dev, *pd);
 	if (!pd)
@@ -1072,12 +1066,10 @@ static int rockchip_pm_add_subdomain(struct rockchip_pmu *pmu,
 		u32 idx;
 
 		error = of_property_read_u32(parent, "reg", &idx);
-		if (error) {
-			dev_err(pmu->dev,
-				"%pOFn: failed to retrieve domain id (reg): %d\n",
-				parent, error);
-			return error;
-		}
+		if (error)
+			return dev_err_probe(pmu->dev, error,
+					     "%pOFn: failed to retrieve domain id (reg)\n",
+					     parent);
 		parent_domain = pmu->genpd_data.domains[idx];
 
 		error = rockchip_pm_add_one_domain(pmu, np,
@@ -1091,23 +1083,20 @@ static int rockchip_pm_add_subdomain(struct rockchip_pmu *pmu,
 		}
 
 		error = of_property_read_u32(np, "reg", &idx);
-		if (error) {
-			dev_err(pmu->dev,
-				"%pOFn: failed to retrieve domain id (reg): %d\n",
-				np, error);
-			return error;
-		}
+		if (error)
+			return dev_err_probe(pmu->dev, error,
+					     "%pOFn: failed to retrieve domain id (reg)\n",
+					     np);
 		child_domain = pmu->genpd_data.domains[idx];
 
 		error = pm_genpd_add_subdomain(parent_domain, child_domain);
-		if (error) {
-			dev_err(pmu->dev, "%s failed to add subdomain %s: %d\n",
-				parent_domain->name, child_domain->name, error);
-			return error;
-		} else {
-			dev_dbg(pmu->dev, "%s add subdomain: %s\n",
-				parent_domain->name, child_domain->name);
-		}
+		if (error)
+			return dev_err_probe(pmu->dev, error,
+					     "%s failed to add subdomain %s\n",
+					     parent_domain->name, child_domain->name);
+
+		dev_dbg(pmu->dev, "%s add subdomain: %s\n",
+			parent_domain->name, child_domain->name);
 
 		error = rockchip_pm_add_subdomain(pmu, np);
 		if (error)
@@ -1126,10 +1115,8 @@ static int rockchip_pm_domain_probe(struct platform_device *pdev)
 	const struct rockchip_pmu_info *pmu_info;
 	int error;
 
-	if (!np) {
-		dev_err(dev, "device tree node not found\n");
-		return -ENODEV;
-	}
+	if (!np)
+		return dev_err_probe(dev, -ENODEV, "device tree node not found\n");
 
 	pmu_info = device_get_match_data(dev);
 
@@ -1146,16 +1133,13 @@ static int rockchip_pm_domain_probe(struct platform_device *pdev)
 	pmu->genpd_data.num_domains = pmu_info->num_domains;
 
 	parent = dev->parent;
-	if (!parent) {
-		dev_err(dev, "no parent for syscon devices\n");
-		return -ENODEV;
-	}
+	if (!parent)
+		return dev_err_probe(dev, -ENODEV, "no parent for syscon devices\n");
 
 	pmu->regmap = syscon_node_to_regmap(parent->of_node);
-	if (IS_ERR(pmu->regmap)) {
-		dev_err(dev, "no regmap available\n");
-		return PTR_ERR(pmu->regmap);
-	}
+	if (IS_ERR(pmu->regmap))
+		return dev_err_probe(dev, PTR_ERR(pmu->regmap),
+				     "no regmap available\n");
 
 	/*
 	 * Configure power up and down transition delays for CORE
@@ -1204,7 +1188,7 @@ static int rockchip_pm_domain_probe(struct platform_device *pdev)
 
 	error = of_genpd_add_provider_onecell(np, &pmu->genpd_data);
 	if (error) {
-		dev_err(dev, "failed to add provider: %d\n", error);
+		dev_err_probe(dev, error, "failed to add provider\n");
 		goto err_out;
 	}
 

-- 
2.55.0



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 3/3] pmdomain: rockchip: report domain errors where they happen
  2026-11-26 10:01 [PATCH 0/3] pmdomain: rockchip: probe error clean-ups Arun Iyengar via B4 Relay
  2026-11-26 10:01 ` [PATCH 1/3] pmdomain: rockchip: keep the pm_qos regmap error code Arun Iyengar via B4 Relay
  2026-11-26 10:01 ` [PATCH 2/3] pmdomain: rockchip: use dev_err_probe() in the probe path Arun Iyengar via B4 Relay
@ 2026-11-26 10:01 ` Arun Iyengar via B4 Relay
  2 siblings, 0 replies; 4+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-11-26 10:01 UTC (permalink / raw)
  To: Ulf Hansson, Heiko Stuebner, Shawn Lin, Sebastian Reichel
  Cc: linux-pm, linux-arm-kernel, linux-rockchip, linux-kernel, Yao Zi,
	Arun Iyengar

From: Arun Iyengar <aiyengar1990@gmail.com>

Print the clock prepare and pm_qos failures with dev_err_probe() and
drop the callers' "failed to handle node" messages. Each error is now
reported once, and -ENOMEM stays quiet.

Suggested-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
 drivers/pmdomain/rockchip/pm-domains.c | 40 +++++++++++++++-------------------
 1 file changed, 17 insertions(+), 23 deletions(-)

diff --git a/drivers/pmdomain/rockchip/pm-domains.c b/drivers/pmdomain/rockchip/pm-domains.c
index 9d5a79c6d4f9..c3df32934120 100644
--- a/drivers/pmdomain/rockchip/pm-domains.c
+++ b/drivers/pmdomain/rockchip/pm-domains.c
@@ -881,17 +881,19 @@ static int rockchip_pm_add_one_domain(struct rockchip_pmu *pmu,
 	for (i = 0; i < pd->num_clks; i++) {
 		pd->clks[i].clk = of_clk_get(node, i);
 		if (IS_ERR(pd->clks[i].clk)) {
-			error = PTR_ERR(pd->clks[i].clk);
-			dev_err_probe(pmu->dev, error,
-				      "%pOFn: failed to get clk at index %d: %d\n",
-				      node, i, error);
+			error = dev_err_probe(pmu->dev, PTR_ERR(pd->clks[i].clk),
+					      "%pOFn: failed to get clk at index %d\n",
+					      node, i);
 			goto err_put_clocks;
 		}
 	}
 
 	error = clk_bulk_prepare(pd->num_clks, pd->clks);
-	if (error)
+	if (error) {
+		dev_err_probe(pmu->dev, error,
+			      "%pOFn: failed to prepare clocks\n", node);
 		goto err_put_clocks;
+	}
 
 	pd->num_qos = of_count_phandle_with_args(node, "pm_qos",
 						 NULL);
@@ -916,13 +918,18 @@ static int rockchip_pm_add_one_domain(struct rockchip_pmu *pmu,
 		for (j = 0; j < pd->num_qos; j++) {
 			qos_node = of_parse_phandle(node, "pm_qos", j);
 			if (!qos_node) {
-				error = -ENODEV;
+				error = dev_err_probe(pmu->dev, -ENODEV,
+						      "%pOFn: failed to get pm_qos %d\n",
+						      node, j);
 				goto err_unprepare_clocks;
 			}
 			pd->qos_regmap[j] = syscon_node_to_regmap(qos_node);
 			of_node_put(qos_node);
 			if (IS_ERR(pd->qos_regmap[j])) {
-				error = PTR_ERR(pd->qos_regmap[j]);
+				error = dev_err_probe(pmu->dev,
+						      PTR_ERR(pd->qos_regmap[j]),
+						      "%pOFn: failed to get pm_qos %d regmap\n",
+						      node, j);
 				goto err_unprepare_clocks;
 			}
 		}
@@ -1074,13 +1081,8 @@ static int rockchip_pm_add_subdomain(struct rockchip_pmu *pmu,
 
 		error = rockchip_pm_add_one_domain(pmu, np,
 						   to_rockchip_pd(parent_domain));
-		if (error) {
-			if (error != -EPROBE_DEFER)
-				dev_err(pmu->dev,
-					"failed to handle node %pOFn: %d\n",
-					np, error);
+		if (error)
 			return error;
-		}
 
 		error = of_property_read_u32(np, "reg", &idx);
 		if (error)
@@ -1162,20 +1164,12 @@ static int rockchip_pm_domain_probe(struct platform_device *pdev)
 
 	for_each_available_child_of_node_scoped(np, node) {
 		error = rockchip_pm_add_one_domain(pmu, node, NULL);
-		if (error) {
-			if (error != -EPROBE_DEFER)
-				dev_err(dev, "failed to handle node %pOFn: %d\n",
-					node, error);
+		if (error)
 			goto err_out;
-		}
 
 		error = rockchip_pm_add_subdomain(pmu, node);
-		if (error < 0) {
-			if (error != -EPROBE_DEFER)
-				dev_err(dev, "failed to handle subdomain node %pOFn: %d\n",
-					node, error);
+		if (error < 0)
 			goto err_out;
-		}
 
 		/* A domain left on is not fatal; carry on with the others. */
 		rockchip_pm_power_off_subtree(pmu, node);

-- 
2.55.0



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-26 10:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-26 10:01 [PATCH 0/3] pmdomain: rockchip: probe error clean-ups Arun Iyengar via B4 Relay
2026-11-26 10:01 ` [PATCH 1/3] pmdomain: rockchip: keep the pm_qos regmap error code Arun Iyengar via B4 Relay
2026-11-26 10:01 ` [PATCH 2/3] pmdomain: rockchip: use dev_err_probe() in the probe path Arun Iyengar via B4 Relay
2026-11-26 10:01 ` [PATCH 3/3] pmdomain: rockchip: report domain errors where they happen Arun Iyengar via B4 Relay

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®