Merge remote-tracking branches 'asoc/topic/simple', 'asoc/topic/spear', 'asoc/topic...
[sfrench/cifs-2.6.git] / sound / soc / generic / audio-graph-scu-card.c
index dcd2df37bc3bfbd78e1f0d7bbb50b5192a89cc2d..a967aa143d51864cb03e3c9f8fcb9c7ea72c8a51 100644 (file)
@@ -56,7 +56,7 @@ static void asoc_graph_card_shutdown(struct snd_pcm_substream *substream)
        asoc_simple_card_clk_disable(dai_props);
 }
 
-static struct snd_soc_ops asoc_graph_card_ops = {
+static const struct snd_soc_ops asoc_graph_card_ops = {
        .startup = asoc_graph_card_startup,
        .shutdown = asoc_graph_card_shutdown,
 };
@@ -215,7 +215,6 @@ static int asoc_graph_card_parse_of(struct graph_card_data *priv)
                codec_ep = of_graph_get_remote_endpoint(cpu_ep);
                rcpu_ep  = of_graph_get_remote_endpoint(codec_ep);
 
-               of_node_put(cpu_port);
                of_node_put(cpu_ep);
                of_node_put(codec_ep);
                of_node_put(rcpu_ep);
@@ -232,8 +231,10 @@ static int asoc_graph_card_parse_of(struct graph_card_data *priv)
 
                ret = asoc_simple_card_parse_daifmt(dev, cpu_ep, codec_ep,
                                                            NULL, &daifmt);
-               if (ret < 0)
+               if (ret < 0) {
+                       of_node_put(cpu_port);
                        goto parse_of_err;
+               }
        }
 
        dai_idx = 0;
@@ -250,7 +251,6 @@ static int asoc_graph_card_parse_of(struct graph_card_data *priv)
                        codec_ep = of_graph_get_remote_endpoint(cpu_ep);
                        codec_port = of_graph_get_port_parent(codec_ep);
 
-                       of_node_put(cpu_port);
                        of_node_put(cpu_ep);
                        of_node_put(codec_ep);
                        of_node_put(codec_port);
@@ -266,13 +266,17 @@ static int asoc_graph_card_parse_of(struct graph_card_data *priv)
 
                                /* Back-End (= Codec) */
                                ret = asoc_graph_card_dai_link_of(codec_ep, priv, daifmt, dai_idx++, 0);
-                               if (ret < 0)
+                               if (ret < 0) {
+                                       of_node_put(cpu_port);
                                        goto parse_of_err;
+                               }
                        } else {
                                /* Front-End (= CPU) */
                                ret = asoc_graph_card_dai_link_of(cpu_ep, priv, daifmt, dai_idx++, 1);
-                               if (ret < 0)
+                               if (ret < 0) {
+                                       of_node_put(cpu_port);
                                        goto parse_of_err;
+                               }
                        }
                }
        }
@@ -306,7 +310,6 @@ static int asoc_graph_get_dais_count(struct device *dev)
                codec_ep = of_graph_get_remote_endpoint(cpu_ep);
                codec_port = of_graph_get_port_parent(codec_ep);
 
-               of_node_put(cpu_port);
                of_node_put(cpu_ep);
                of_node_put(codec_ep);
                of_node_put(codec_port);
@@ -398,6 +401,7 @@ MODULE_DEVICE_TABLE(of, asoc_graph_of_match);
 static struct platform_driver asoc_graph_card = {
        .driver = {
                .name = "asoc-audio-graph-scu-card",
+               .pm = &snd_soc_pm_ops,
                .of_match_table = asoc_graph_of_match,
        },
        .probe = asoc_graph_card_probe,