FAILED: patch "[PATCH] ASoC: ti: davinci-mcasp: Fix race condition during probe" failed to apply to 4.19-stable tree
Subsystems (4)
[email protected]
maintainerThe patch below does not apply to the 4.19-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-4.19.y
git checkout FETCH_HEAD
git cherry-pick -x d18ca8635db2f88c17acbdf6412f26d4f6aff414
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2024051308-sullen-plug-a6fb@gregkh' --subject-prefix 'PATCH 4.19.y' HEAD^..
Possible dependencies:
d18ca8635db2 ("ASoC: ti: davinci-mcasp: Fix race condition during probe") 1b4fb70e5b28 ("ASoC: ti: davinci-mcasp: Handle missing required DT properties") 1125d925990b ("ASoC: ti: davinci-mcasp: Simplify the configuration parameter handling") db8793a39b29 ("ASoC: ti: davinci-mcasp: Remove legacy dma_request parsing") 372c4bd11de1 ("ASoC: ti: davinci-mcasp: Use platform_get_irq_byname_optional") 19f6e424d615 ("ASoC: ti: davinci-mcasp: remove always zero of davinci_mcasp_get_dt_params") f4d95de415b2 ("ASoC: ti: davinci-mcasp: remove redundant assignment to variable ret") 764958f2b523 ("ASoC: ti: davinci-mcasp: Support for auxclk-fs-ratio") 540f1ba7b3a5 ("ASoC: ti: davinci-mcasp: Add support for GPIO mode of the pins") 617547175507 ("ASoC: ti: davinci-mcasp: Move context save/restore to runtime_pm callbacks") f2055e145f29 ("ASoC: ti: Merge davinci and omap directories")bc1845498531 ("ASoC: davinci-mcasp: Implement configurable dismod handling") ca3d9433349e ("ASoC: davinci-mcasp: Update PDIR (pin direction) register handling") 9c34d023dc35 ("ASoC: omap-mcbsp: Re-arrange files for core McBSP and Sidetone function split") be51c576e849 ("ASoC: omap-mcbsp: Move out the FIFO check from set_threshold and get_delay") 59d177f65f50 ("ASoC: omap-mcbsp: Simplify the mcbsp_start/_stop function parameters") d63a7625a6df ("ASoC: omap-mcbsp: Clean up the interrupt handlers")c9ece9c29e26 ("ASoC: omap-mcbsp: Skip dma_data.maxburst initialization") dd443a7c0b00 ("ASoC: omap-mcbsp: Clean up dma_data addr initialization code") 2c2596f3ab25 ("ASoC: omap: Remove unused machine driver for AM3517-evm")
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From d18ca8635db2f88c17acbdf6412f26d4f6aff414 Mon Sep 17 00:00:00 2001
From: Joao Paulo Goncalves <[email protected]>
Date: Wed, 17 Apr 2024 15:41:38 -0300
Subject: [PATCH] ASoC: ti: davinci-mcasp: Fix race condition during probe
When using davinci-mcasp as CPU DAI with simple-card, there are some conditions that cause simple-card to finish registering a sound card before davinci-mcasp finishes registering all sound components. This creates a non-working sound card from userspace with no problem indication apart from not being able to play/record audio on a PCM stream. The issue arises during simultaneous probe execution of both drivers. Specifically, the simple-card driver, awaiting a CPU DAI, proceeds as soon as davinci-mcasp registers its DAI. However, this process can lead to the client mutex lock (client_mutex in soc-core.c) being held or davinci-mcasp being preempted before PCM DMA registration on davinci-mcasp finishes. This situation occurs when the probes of both drivers run concurrently. Below is the code path for this condition. To solve the issue, defer davinci-mcasp CPU DAI registration to the last step in the audio part of it. This way, simple-card CPU DAI parsing will be deferred until all audio components are registered.
Fail Code Path:
simple-card.c: probe startssimple-card.c: simple_dai_link_of: simple_parse_node(..,cpu,..) returns EPROBE_DEFER, no CPU DAI yet davinci-mcasp.c: probe startsdavinci-mcasp.c: devm_snd_soc_register_component() register CPU DAIsimple-card.c: probes again, finish CPU DAI parsing and call devm_snd_soc_register_card() simple-card.c: finish probedavinci-mcasp.c: *dma_pcm_platform_register() register PCM DMAdavinci-mcasp.c: probe finish
sound/soc/ti/davinci-mcasp.c +6 -6
@@ -2417,12 +2417,6 @@ static int davinci_mcasp_probe(struct platform_device *pdev)mcasp_reparent_fck (pdev); - ret =devm_snd_soc_register_component (&pdev->dev, &davinci_mcasp_component, - &davinci_mcasp_dai[mcasp->op_mode],1 ); - -if (ret !=0 ) - goto err; - ret =davinci_mcasp_get_dma_type (mcasp);switch (ret) {case PCM_EDMA :
@@ -2449,6 +2443,12 @@ static int davinci_mcasp_probe(struct platform_device *pdev) goto err; } + ret =devm_snd_soc_register_component (&pdev->dev, &davinci_mcasp_component, + &davinci_mcasp_dai[mcasp->op_mode],1 ); + +if (ret !=0 ) + goto err; + no_audio: ret =davinci_mcasp_init_gpiochip (mcasp);if (ret) {