ASoC: mediatek: address dai link array entries by enum
authorPhilipp Zabel <p.zabel@pengutronix.de>
Wed, 2 Mar 2016 14:49:06 +0000 (15:49 +0100)
committerMark Brown <broonie@kernel.org>
Sat, 5 Mar 2016 04:46:06 +0000 (13:46 +0900)
This should be more robust to future changes than adressing
array entries by index number.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/mediatek/mt8173-rt5650-rt5676.c

index 50ba538eccb3f771da9c08685d4e33aa0cbfa80b..5c4c58c69c516aa32b76ae1e141f01685a6f0f62 100644 (file)
@@ -131,10 +131,17 @@ static struct snd_soc_dai_link_component mt8173_rt5650_rt5676_codecs[] = {
        },
 };
 
+enum {
+       DAI_LINK_PLAYBACK,
+       DAI_LINK_CAPTURE,
+       DAI_LINK_CODEC_I2S,
+       DAI_LINK_INTERCODEC
+};
+
 /* Digital audio interface glue - connects codec <---> CPU */
 static struct snd_soc_dai_link mt8173_rt5650_rt5676_dais[] = {
        /* Front End DAI links */
-       {
+       [DAI_LINK_PLAYBACK] = {
                .name = "rt5650_rt5676 Playback",
                .stream_name = "rt5650_rt5676 Playback",
                .cpu_dai_name = "DL1",
@@ -144,7 +151,7 @@ static struct snd_soc_dai_link mt8173_rt5650_rt5676_dais[] = {
                .dynamic = 1,
                .dpcm_playback = 1,
        },
-       {
+       [DAI_LINK_CAPTURE] = {
                .name = "rt5650_rt5676 Capture",
                .stream_name = "rt5650_rt5676 Capture",
                .cpu_dai_name = "VUL",
@@ -156,7 +163,7 @@ static struct snd_soc_dai_link mt8173_rt5650_rt5676_dais[] = {
        },
 
        /* Back End DAI links */
-       {
+       [DAI_LINK_CODEC_I2S] = {
                .name = "Codec",
                .cpu_dai_name = "I2S",
                .no_pcm = 1,
@@ -170,7 +177,8 @@ static struct snd_soc_dai_link mt8173_rt5650_rt5676_dais[] = {
                .dpcm_playback = 1,
                .dpcm_capture = 1,
        },
-       { /* rt5676 <-> rt5650 intercodec link: Sets rt5676 I2S2 as master */
+       /* rt5676 <-> rt5650 intercodec link: Sets rt5676 I2S2 as master */
+       [DAI_LINK_INTERCODEC] = {
                .name = "rt5650_rt5676 intercodec",
                .stream_name = "rt5650_rt5676 intercodec",
                .cpu_dai_name = "snd-soc-dummy-dai",
@@ -240,7 +248,7 @@ static int mt8173_rt5650_rt5676_dev_probe(struct platform_device *pdev)
        mt8173_rt5650_rt5676_codec_conf[0].of_node =
                mt8173_rt5650_rt5676_codecs[1].of_node;
 
-       mt8173_rt5650_rt5676_dais[3].codec_of_node =
+       mt8173_rt5650_rt5676_dais[DAI_LINK_INTERCODEC].codec_of_node =
                mt8173_rt5650_rt5676_codecs[1].of_node;
 
        card->dev = &pdev->dev;