[alsa-devel] [PATCH 1/3] ASoC: rsnd: add rsnd_daidrv_get()

Kuninori Morimoto kuninori.morimoto.gx at renesas.com
Tue Jun 12 07:51:46 CEST 2018


From: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>

rsnd priv has many parameters. On __rsnd_dai_probe() it uses
rsnd_rdai_get() to get rdai pointer, but is using priv->daidrv
directly to get daidrvhv, but it is confusable for reader.
This patch adds rsnd_daidrv_get() to get daidrv from priv.
Now reader can understand that rdai and daidrv are related.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
Tested-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx at renesas.com>
---
 sound/soc/sh/rcar/core.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index af04d41..2c6a2b3 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -552,6 +552,15 @@ struct rsnd_dai *rsnd_rdai_get(struct rsnd_priv *priv, int id)
 	return priv->rdai + id;
 }
 
+static struct snd_soc_dai_driver
+*rsnd_daidrv_get(struct rsnd_priv *priv, int id)
+{
+	if ((id < 0) || (id >= rsnd_rdai_nr(priv)))
+		return NULL;
+
+	return priv->daidrv + id;
+}
+
 #define rsnd_dai_to_priv(dai) snd_soc_dai_get_drvdata(dai)
 static struct rsnd_dai *rsnd_dai_to_rdai(struct snd_soc_dai *dai)
 {
@@ -1037,7 +1046,7 @@ static void __rsnd_dai_probe(struct rsnd_priv *priv,
 	int io_i;
 
 	rdai		= rsnd_rdai_get(priv, dai_i);
-	drv		= priv->daidrv + dai_i;
+	drv		= rsnd_daidrv_get(priv, dai_i);
 	io_playback	= &rdai->playback;
 	io_capture	= &rdai->capture;
 
-- 
1.9.1



More information about the Alsa-devel mailing list