All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Daniel Carter" <yass27106@gmail.com>
Cc: linux-sound@vger.kernel.org, devicetree@vger.kernel.org,
	robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v2 3/3] ASoC: qcom: lpass macro / soundwire: retry deferred clock acquisition
Date: Fri, 13 Nov 2026 20:47:01 +0000	[thread overview]
Message-ID: <sashiko-outbox-213678@kernel.org> (raw)
In-Reply-To: <c0b2628bb8824cb0a61dacb714f94af2@gmail.com>

Thank you for your contribution! Sashiko AI review found 4 potential
issues to consider:
- [High] ASoC: qcom: 30s msleep() retry in probe stalls
  deferred_probe_work
- [High] soundwire: qcom: unused static clk_get_retry_optional() breaks
  Werror build
- [High] ASoC: qcom: missing Signed-off-by trailer and commit message
  body
- [Low] ASoC: qcom: clk_get_retry() helpers duplicated across five
  driver files
--

commit 9ed54c71b350e8398fe1839f5ec457bda202d8b0
Author: Daniel Carter <yass27106@gmail.com>

> ASoC: qcom: lpass macro / soundwire: retry deferred clock acquisition
> 
> drivers/soundwire/qcom.c           | 37 +++++++++++++++++++++++-
>  sound/soc/codecs/lpass-rx-macro.c  | 45 ++++++++++++++++++++++++++----
>  sound/soc/codecs/lpass-tx-macro.c  | 45 ++++++++++++++++++++++++++----
>  sound/soc/codecs/lpass-va-macro.c  | 43 +++++++++++++++++++++++++---
>  sound/soc/codecs/lpass-wsa-macro.c | 45 ++++++++++++++++++++++++++----
>  5 files changed, 195 insertions(+), 20 deletions(-)

[Severity: High]
This commit is missing a Signed-off-by: trailer, and the commit message
body contains only a diffstat without explaining why this change is
needed.

> diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
> index c31d921f679f9..afb71624dae2a 100644
> --- a/drivers/soundwire/qcom.c
> +++ b/drivers/soundwire/qcom.c
> @@ -21,6 +21,41 @@
>  #include <sound/pcm_params.h>
>  #include <sound/soc.h>
>  #include "bus.h"
> +#include <linux/delay.h>
> +
> +/*
> + * Bounded retry for deferred clock providers. Clock-provider registration
> + * does not trigger deferred-probe retries, so a consumer that loses the
> + * probe-order race stays deferred forever. Wait up to 30 s for providers
> + * that are registered milliseconds later.
> + */
> +static struct clk *clk_get_retry(struct device *dev, const char *id)
> +{
> +	struct clk *c;
> +	int i;
> +
> +	for (i = 0; i < 60; i++) {
> +		c = devm_clk_get(dev, id);
> +		if (!IS_ERR(c) || PTR_ERR(c) != -EPROBE_DEFER)
> +			return c;
> +		msleep(500);
> +	}
> +	return c;
> +}

[Severity: High]
Does sleeping for 30 seconds in clk_get_retry() and
clk_get_retry_optional() block the very probe thread needed to register
the supplier clocks?

None of these drivers sets PROBE_PREFER_ASYNCHRONOUS, so both initcalls
and deferred_probe_work_func() run .probe() callbacks sequentially on a
single thread.  The modified drivers also supply clocks to one another:
va_macro_probe() registers the fsgen clock consumed by rx_macro_probe(),
tx_macro_probe(), and wsa_macro_probe(), while the macro drivers register
the mclk clock consumed as iface by qcom_swrm_probe().

Because drivers/soundwire/ and wsa-macro are linked and ordered in device
trees before va-macro, a consumer probing before va_macro_probe() (or
q6prmcc) sleeps for the full 30 seconds on that single thread, preventing
the supplier from probing and registering the clock until the loop gives
up and returns -EPROBE_DEFER anyway.  This stalls boot or deferred probing
for 30 seconds per device and can expire driver_deferred_probe_timeout,
while in va_macro_probe() sleeping on va->npl also leaves the va->pds
power domains powered on for 30 seconds.

In addition, clock suppliers registered from a driver .probe() callback do
trigger deferred probe retries via really_probe() -> driver_bound() ->
driver_deferred_probe_trigger().

> +
> +static struct clk *clk_get_retry_optional(struct device *dev, const char *id)
> +{
> +	struct clk *c;
> +	int i;
> +
> +	for (i = 0; i < 60; i++) {
> +		c = devm_clk_get_optional(dev, id);
> +		if (!IS_ERR(c) || PTR_ERR(c) != -EPROBE_DEFER)
> +			return c;
> +		msleep(500);
> +	}
> +	return c;
> +}
>  
>  #define SWRM_COMP_SW_RESET					0x008
>  #define SWRM_COMP_STATUS					0x014
> @@ -1669,7 +1704,7 @@ static int qcom_swrm_probe(struct platform_device *pdev)
>  		goto err_init;
>  	}
>  
> -	ctrl->hclk = devm_clk_get(dev, "iface");
> +	ctrl->hclk = clk_get_retry(dev, "iface");

[Severity: High]
Does defining clk_get_retry_optional() in drivers/soundwire/qcom.c without
any callers trigger a -Wunused-function warning and break builds with
CONFIG_WERROR=y?

> diff --git a/sound/soc/codecs/lpass-rx-macro.c b/sound/soc/codecs/lpass-rx-macro.c
> index ab8a1c2b0489b..c953054eb7a38 100644
> --- a/sound/soc/codecs/lpass-rx-macro.c
> +++ b/sound/soc/codecs/lpass-rx-macro.c
> @@ -18,6 +18,41 @@
>  #include <linux/clk-provider.h>
>  
>  #include "lpass-macro-common.h"
> +#include <linux/delay.h>
> +
> +/*
> + * Bounded retry for deferred clock providers. Clock-provider registration
> + * does not trigger deferred-probe retries, so a consumer that loses the
> + * probe-order race stays deferred forever. Wait up to 30 s for providers
> + * that are registered milliseconds later.
> + */
> +static struct clk *clk_get_retry(struct device *dev, const char *id)
> +{
> +	struct clk *c;
> +	int i;
> +
> +	for (i = 0; i < 60; i++) {
> +		c = devm_clk_get(dev, id);
> +		if (!IS_ERR(c) || PTR_ERR(c) != -EPROBE_DEFER)
> +			return c;
> +		msleep(500);
> +	}
> +	return c;
> +}
> +
> +static struct clk *clk_get_retry_optional(struct device *dev, const char *id)
> +{
> +	struct clk *c;
> +	int i;
> +
> +	for (i = 0; i < 60; i++) {
> +		c = devm_clk_get_optional(dev, id);
> +		if (!IS_ERR(c) || PTR_ERR(c) != -EPROBE_DEFER)
> +			return c;
> +		msleep(500);
> +	}
> +	return c;
> +}

[Severity: Low]
This isn't a bug, but clk_get_retry() and clk_get_retry_optional() are
duplicated verbatim across five source files, four of which already share
sound/soc/codecs/lpass-macro-common.h.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/2c4a807496c04047b6d5735e3946dd16@gmail.com?part=3

  reply	other threads:[~2026-11-13 20:47 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13 13:24 [PATCH 0/2] qcom: add Asus Vivobook 16 X1607QA DT + LPASS audio clock retry yass27106
2026-11-13 13:24 ` [PATCH 1/2] arm64: dts: qcom: add device tree for Asus Vivobook 16 X1607QA yass27106
2026-11-13 13:24   ` [PATCH 2/2] ASoC: qcom: lpass macro / soundwire: retry deferred clock acquisition yass27106
2026-11-13 13:43     ` sashiko-bot
2026-11-13 15:04     ` Mark Brown
2026-11-13 13:39   ` [PATCH 1/2] arm64: dts: qcom: add device tree for Asus Vivobook 16 X1607QA sashiko-bot
2026-11-13 15:44   ` Krzysztof Kozlowski
2026-11-13 20:33     ` [PATCH 1/2] arm64: dts: qcom: add device tree for Asus Vivobook 16 X1607QA — v2 series Daniel Carter
2026-11-13 20:33       ` [PATCH v2 1/3] dt-bindings: qcom: document Asus Vivobook 16 X1607QA Daniel Carter
2026-11-13 20:33         ` [PATCH v2 2/3] arm64: dts: qcom: add device tree for " Daniel Carter
2026-11-13 20:33           ` [PATCH v2 3/3] ASoC: qcom: lpass macro / soundwire: retry deferred clock acquisition Daniel Carter
2026-11-13 20:47             ` sashiko-bot [this message]
2026-11-13 20:51           ` [PATCH v2 2/3] arm64: dts: qcom: add device tree for Asus Vivobook 16 X1607QA sashiko-bot
2026-11-13 20:39         ` [PATCH v2 1/3] dt-bindings: qcom: document " sashiko-bot
2026-11-13 21:02       ` [PATCH v2 1/3] arm64: dts: qcom: add device tree for Asus Vivobook 16 X1607QA - v3 series Daniel Carter
2026-11-13 21:02         ` [PATCH v3 1/4] dt-bindings: qcom: document Asus Vivobook 16 X1607QA Daniel Carter
2026-11-13 21:02           ` [PATCH v3 2/4] arm64: dts: qcom: add device tree for " Daniel Carter
2026-11-13 21:02             ` [PATCH v3 3/4] ASoC: qcom: lpass macro / soundwire: asynchronous probe with clock retry Daniel Carter
2026-11-13 21:02               ` [PATCH v3 4/4] soundwire: qcom: check clk_prepare_enable() return values Daniel Carter
2026-11-13 21:19                 ` sashiko-bot
2026-11-13 21:19               ` [PATCH v3 3/4] ASoC: qcom: lpass macro / soundwire: asynchronous probe with clock retry sashiko-bot
2026-11-13 21:06           ` [PATCH v3 1/4] dt-bindings: qcom: document Asus Vivobook 16 X1607QA Mark Brown
2026-11-13 21:17             ` Daniel Carter
2026-11-13 21:29               ` Mark Brown

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=sashiko-outbox-213678@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=yass27106@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.