ASoC: rsrc-card: tidyup priv->snd_card setup timing
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Mon, 15 Jun 2015 06:22:05 +0000 (06:22 +0000)
committerMark Brown <broonie@kernel.org>
Tue, 16 Jun 2015 11:34:01 +0000 (12:34 +0100)
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sh/rcar/rsrc-card.c

index 9a1926f8d348c18c39191d52b389b7f019558fd7..cdd005b826600e7dd9f8b2b71aff24da30235b74 100644 (file)
@@ -391,9 +391,9 @@ dai_link_of_err:
 }
 
 static int rsrc_card_parse_of(struct device_node *node,
-                             struct rsrc_card_priv *priv)
+                             struct rsrc_card_priv *priv,
+                             struct device *dev)
 {
-       struct device *dev = rsrc_priv_to_dev(priv);
        const struct rsrc_card_of_data *of_data = rsrc_dev_to_of_data(dev);
        int ret;
        int i;
@@ -404,7 +404,13 @@ static int rsrc_card_parse_of(struct device_node *node,
        /* Parse the card name from DT */
        snd_soc_of_parse_card_name(&priv->snd_card, "card-name");
 
-       /* DAPM routes */
+       /* Init snd_soc_card */
+       priv->snd_card.owner                    = THIS_MODULE;
+       priv->snd_card.dev                      = dev;
+       priv->snd_card.dai_link                 = priv->dai_link;
+       priv->snd_card.num_links                = RSRC_FB_NUM;
+       priv->snd_card.codec_conf               = &priv->codec_conf;
+       priv->snd_card.num_configs              = 1;
        priv->snd_card.of_dapm_routes           = of_data->routes;
        priv->snd_card.num_of_dapm_routes       = of_data->num_routes;
 
@@ -446,7 +452,6 @@ static int rsrc_card_unref(struct snd_soc_card *card)
 static int rsrc_card_probe(struct platform_device *pdev)
 {
        struct rsrc_card_priv *priv;
-       struct snd_soc_dai_link *dai_link;
        struct device_node *np = pdev->dev.of_node;
        struct device *dev = &pdev->dev;
        int ret;
@@ -456,16 +461,7 @@ static int rsrc_card_probe(struct platform_device *pdev)
        if (!priv)
                return -ENOMEM;
 
-       /* Init snd_soc_card */
-       priv->snd_card.owner = THIS_MODULE;
-       priv->snd_card.dev = dev;
-       dai_link = priv->dai_link;
-       priv->snd_card.dai_link = dai_link;
-       priv->snd_card.num_links = RSRC_FB_NUM;
-       priv->snd_card.codec_conf = &priv->codec_conf;
-       priv->snd_card.num_configs = 1;
-
-       ret = rsrc_card_parse_of(np, priv);
+       ret = rsrc_card_parse_of(np, priv, dev);
        if (ret < 0) {
                if (ret != -EPROBE_DEFER)
                        dev_err(dev, "parse error %d\n", ret);