Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Heiko Stübner" <heiko@sntech.de>
To: Ulf Hansson <ulfh@kernel.org>,
	Shawn Lin <shawn.lin@rock-chips.com>,
	Sebastian Reichel <sebastian.reichel@collabora.com>,
	Kevin Hilman <khilman@linaro.org>,
	Caesar Wang <wxt@rock-chips.com>,
	Elaine Zhang <zhangqing@rock-chips.com>,
	aiyengar1990@gmail.com
Cc: linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org,
	Yao Zi <me@ziyao.cc>, Igor Pecovnik <igor@armbian.com>,
	Arun Iyengar <aiyengar1990@gmail.com>
Subject: Re: [PATCH v2 2/2] pmdomain: rockchip: report domain errors once, with dev_err_probe()
Date: Thu, 12 Nov 2026 11:02:55 +0100	[thread overview]
Message-ID: <vl0MwP82Qg6ZXLwjtntobA@sntech.de> (raw)
In-Reply-To: <20261112-pmdomain-rockchip-v2-2-5cd942a23df7@gmail.com>

Am Donnerstag, 12. November 2026, 09:23:30 Mitteleuropäische Normalzeit schrieb Arun Iyengar via B4 Relay:
> From: Arun Iyengar <aiyengar1990@gmail.com>
> 
> When a power domain clock is not available yet,
> rockchip_pm_add_one_domain() returns -EPROBE_DEFER, and both it and its
> callers rockchip_pm_domain_probe() and rockchip_pm_add_subdomain() print
> that with dev_err():
> 
>   rockchip-pm-domain ...: power-domain: failed to get clk at index 1: -517
>   rockchip-pm-domain ...: failed to handle node power-domain: -517
> 
> once per probe attempt, and the second line twice for a nested domain.
> On an RK3588 board whose NPU domain clock appears late this is more than
> 20 error lines before the domain finally probes, and the reason of the
> deferral is not recorded. Other failures are reported twice (once where
> they happen and once by the callers), or only by the callers, which name
> the node but not what failed: a missing pm_qos phandle and a pm_qos node
> without a regmap print nothing in rockchip_pm_add_one_domain(), and a
> failed clk_bulk_prepare() only has the message of the clk core, which
> names neither the device nor the domain.
> 
> Report every error once, where it happens, with dev_err_probe(), and
> drop the "failed to handle (subdomain) node" messages from the callers.
> A deferral is then quiet and keeps its specific reason in
> /sys/kernel/debug/devices_deferred, such as "failed to get clk at index
> 1", and -ENOMEM, which the callers used to print, is quiet as well. The
> return values are unchanged, except that a failed
> syscon_node_to_regmap() for a pm_qos node now returns its own error
> instead of -ENODEV: it can be -EPROBE_DEFER (a syscon regmap that is
> not registered yet, or a syscon clock or hwlock that is not available
> yet), which must not turn into a probe failure.
> 
> Fixes: 7c696693a4f5 ("soc: rockchip: power-domain: Add power domain driver")
> Fixes: 6be05b5ec161 ("soc: rockchip: power-domain: add support for sub-power domains")
> Suggested-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>

code change itself looks fine, but pretty please cut down the text length
in all your patches a lot.

You're simply converting to dev_err_probe here to not show defer messages.
This does definitly not need 3 quite long paragraphs of text.

This applys for all patches you sent recently :-) .

Same is true for the big'ish comment blocks you have in patch1 of this
series (and other series too). They should be short and to the point.

If needed people can get deeper information reading the actual code.


Thanks
Heiko


> ---
>  drivers/pmdomain/rockchip/pm-domains.c | 98 +++++++++++++++-------------------
>  1 file changed, 43 insertions(+), 55 deletions(-)
> 
> diff --git a/drivers/pmdomain/rockchip/pm-domains.c b/drivers/pmdomain/rockchip/pm-domains.c
> index 00c7e78f89b5..be077fb52f40 100644
> --- a/drivers/pmdomain/rockchip/pm-domains.c
> +++ b/drivers/pmdomain/rockchip/pm-domains.c
> @@ -804,28 +804,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)
> @@ -849,17 +843,20 @@ 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(pmu->dev,
> -				"%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);
> @@ -884,13 +881,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 = -ENODEV;
> +				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;
>  			}
>  		}
> @@ -1038,39 +1040,31 @@ 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);
> -		if (error) {
> -			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) {
> -			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)
> @@ -1141,18 +1135,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);
> -		if (error) {
> -			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) {
> -			dev_err(dev, "failed to handle subdomain node %pOFn: %d\n",
> -				node, error);
> +		if (error < 0)
>  			goto err_out;
> -		}
>  	}
>  
>  	if (error) {
> 
> 






  reply	other threads:[~2026-11-12 10:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-12  8:23 [PATCH v2 0/2] pmdomain: rockchip: fix the probe error and deferral paths Arun Iyengar via B4 Relay
2026-11-12  8:23 ` [PATCH v2 1/2] pmdomain: rockchip: remove subdomain links before the domains on error Arun Iyengar via B4 Relay
2026-11-12  8:23 ` [PATCH v2 2/2] pmdomain: rockchip: report domain errors once, with dev_err_probe() Arun Iyengar via B4 Relay
2026-11-12 10:02   ` Heiko Stübner [this message]
2026-11-12 10:52   ` Yao Zi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=vl0MwP82Qg6ZXLwjtntobA@sntech.de \
    --to=heiko@sntech.de \
    --cc=aiyengar1990@gmail.com \
    --cc=igor@armbian.com \
    --cc=khilman@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=me@ziyao.cc \
    --cc=sebastian.reichel@collabora.com \
    --cc=shawn.lin@rock-chips.com \
    --cc=ulfh@kernel.org \
    --cc=wxt@rock-chips.com \
    --cc=zhangqing@rock-chips.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox