[alsa-devel] [PATCH linux-next v1 1/2] ASoC: rsnd: src: Avoid a potential deadlock

Kuninori Morimoto kuninori.morimoto.gx at renesas.com
Thu Mar 7 03:47:21 CET 2019


Hi Jiada

Thank you for your patch

> lockdep warns us that priv->lock and k->k_lock can cause a
> deadlock when after acquire of k->k_lock, process is interrupted
> by src, while in another routine of src .init, k->k_lock is
> acquired with priv->lock held.
> 
> This patch avoids a potential deadlock by not calling soc_device_match()
> in SRC .init callback, instead it adds new soc fields in priv->flags to
> differentiate SoCs.
> 
> Fixes: linux-next commit 7674bec4fc09 ("ASoC: rsnd: update BSDSR/BSDISR handling")
> Signed-off-by: Jiada Wang <jiada_wang at mentor.com>
> ---
(snip)
> @@ -1706,6 +1707,8 @@ static int rsnd_probe(struct platform_device *pdev)
>  
>  	priv->pdev	= pdev;
>  	priv->flags	= (unsigned long)of_device_get_match_data(dev);
> +	if (of_device_is_compatible(np, "renesas,rcar_sound-r8a77990"))
> +		priv->flags |= RSND_SOC_E;
>  	spin_lock_init(&priv->lock);

Updating rsnd_of_match is nice idea
Maybe like this (not tested)

------------
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 9834474..e7ebc75 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -107,9 +107,12 @@
 		   SNDRV_PCM_FMTBIT_S24_LE)
 
 static const struct of_device_id rsnd_of_match[] = {
+	/* General Handling */
 	{ .compatible = "renesas,rcar_sound-gen1", .data = (void *)RSND_GEN1 },
 	{ .compatible = "renesas,rcar_sound-gen2", .data = (void *)RSND_GEN2 },
 	{ .compatible = "renesas,rcar_sound-gen3", .data = (void *)RSND_GEN3 },
+	/* Special Handling */
+	{ .compatible = "renesas,rcar_sound-r8a77990", .data = (void *)(RSND_GEN3 | RSND_SOC_E) },
 	{},
 };
------------


More information about the Alsa-devel mailing list