diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2017-01-23 02:29:42 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2017-01-23 12:46:33 -0500 |
commit | e984fd61e860ce3c45e79d69cf214b8cc6cae7d9 (patch) | |
tree | a45d2fde7ff7103b3f08693ff37466c698f9c17d | |
parent | a5de5b74a50113564a1e0850e2da96c37c35e55d (diff) |
ASoC: simple-card: use devm_get_clk_from_child()
Current simple-card-utils is getting clk by of_clk_get(), but didn't call
clk_free(). Now we can use devm_get_clk_from_child() for this purpose.
Let's use it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | include/sound/simple_card_utils.h | 11 | ||||
-rw-r--r-- | sound/soc/generic/simple-card-utils.c | 8 | ||||
-rw-r--r-- | sound/soc/generic/simple-card.c | 4 | ||||
-rw-r--r-- | sound/soc/generic/simple-scu-card.c | 4 |
4 files changed, 14 insertions, 13 deletions
diff --git a/include/sound/simple_card_utils.h b/include/sound/simple_card_utils.h index 64e90ca9ad32..af58d2362975 100644 --- a/include/sound/simple_card_utils.h +++ b/include/sound/simple_card_utils.h | |||
@@ -34,11 +34,12 @@ int asoc_simple_card_set_dailink_name(struct device *dev, | |||
34 | int asoc_simple_card_parse_card_name(struct snd_soc_card *card, | 34 | int asoc_simple_card_parse_card_name(struct snd_soc_card *card, |
35 | char *prefix); | 35 | char *prefix); |
36 | 36 | ||
37 | #define asoc_simple_card_parse_clk_cpu(node, dai_link, simple_dai) \ | 37 | #define asoc_simple_card_parse_clk_cpu(dev, node, dai_link, simple_dai) \ |
38 | asoc_simple_card_parse_clk(node, dai_link->cpu_of_node, simple_dai) | 38 | asoc_simple_card_parse_clk(dev, node, dai_link->cpu_of_node, simple_dai) |
39 | #define asoc_simple_card_parse_clk_codec(node, dai_link, simple_dai) \ | 39 | #define asoc_simple_card_parse_clk_codec(dev, node, dai_link, simple_dai) \ |
40 | asoc_simple_card_parse_clk(node, dai_link->codec_of_node, simple_dai) | 40 | asoc_simple_card_parse_clk(dev, node, dai_link->codec_of_node, simple_dai) |
41 | int asoc_simple_card_parse_clk(struct device_node *node, | 41 | int asoc_simple_card_parse_clk(struct device *dev, |
42 | struct device_node *node, | ||
42 | struct device_node *dai_of_node, | 43 | struct device_node *dai_of_node, |
43 | struct asoc_simple_dai *simple_dai); | 44 | struct asoc_simple_dai *simple_dai); |
44 | 45 | ||
diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c index cf026252cd4a..4924575d2e95 100644 --- a/sound/soc/generic/simple-card-utils.c +++ b/sound/soc/generic/simple-card-utils.c | |||
@@ -98,7 +98,8 @@ int asoc_simple_card_parse_card_name(struct snd_soc_card *card, | |||
98 | } | 98 | } |
99 | EXPORT_SYMBOL_GPL(asoc_simple_card_parse_card_name); | 99 | EXPORT_SYMBOL_GPL(asoc_simple_card_parse_card_name); |
100 | 100 | ||
101 | int asoc_simple_card_parse_clk(struct device_node *node, | 101 | int asoc_simple_card_parse_clk(struct device *dev, |
102 | struct device_node *node, | ||
102 | struct device_node *dai_of_node, | 103 | struct device_node *dai_of_node, |
103 | struct asoc_simple_dai *simple_dai) | 104 | struct asoc_simple_dai *simple_dai) |
104 | { | 105 | { |
@@ -111,14 +112,13 @@ int asoc_simple_card_parse_clk(struct device_node *node, | |||
111 | * or "system-clock-frequency = <xxx>" | 112 | * or "system-clock-frequency = <xxx>" |
112 | * or device's module clock. | 113 | * or device's module clock. |
113 | */ | 114 | */ |
114 | clk = of_clk_get(node, 0); | 115 | clk = devm_get_clk_from_child(dev, node, NULL); |
115 | if (!IS_ERR(clk)) { | 116 | if (!IS_ERR(clk)) { |
116 | simple_dai->sysclk = clk_get_rate(clk); | 117 | simple_dai->sysclk = clk_get_rate(clk); |
117 | simple_dai->clk = clk; | ||
118 | } else if (!of_property_read_u32(node, "system-clock-frequency", &val)) { | 118 | } else if (!of_property_read_u32(node, "system-clock-frequency", &val)) { |
119 | simple_dai->sysclk = val; | 119 | simple_dai->sysclk = val; |
120 | } else { | 120 | } else { |
121 | clk = of_clk_get(dai_of_node, 0); | 121 | clk = devm_get_clk_from_child(dev, dai_of_node, NULL); |
122 | if (!IS_ERR(clk)) | 122 | if (!IS_ERR(clk)) |
123 | simple_dai->sysclk = clk_get_rate(clk); | 123 | simple_dai->sysclk = clk_get_rate(clk); |
124 | } | 124 | } |
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index a385ff6bfa4b..85b4f1806514 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c | |||
@@ -278,11 +278,11 @@ static int asoc_simple_card_dai_link_of(struct device_node *node, | |||
278 | if (ret < 0) | 278 | if (ret < 0) |
279 | goto dai_link_of_err; | 279 | goto dai_link_of_err; |
280 | 280 | ||
281 | ret = asoc_simple_card_parse_clk_cpu(cpu, dai_link, cpu_dai); | 281 | ret = asoc_simple_card_parse_clk_cpu(dev, cpu, dai_link, cpu_dai); |
282 | if (ret < 0) | 282 | if (ret < 0) |
283 | goto dai_link_of_err; | 283 | goto dai_link_of_err; |
284 | 284 | ||
285 | ret = asoc_simple_card_parse_clk_codec(codec, dai_link, codec_dai); | 285 | ret = asoc_simple_card_parse_clk_codec(dev, codec, dai_link, codec_dai); |
286 | if (ret < 0) | 286 | if (ret < 0) |
287 | goto dai_link_of_err; | 287 | goto dai_link_of_err; |
288 | 288 | ||
diff --git a/sound/soc/generic/simple-scu-card.c b/sound/soc/generic/simple-scu-card.c index bb86ee042490..308ff4c11a8d 100644 --- a/sound/soc/generic/simple-scu-card.c +++ b/sound/soc/generic/simple-scu-card.c | |||
@@ -128,7 +128,7 @@ static int asoc_simple_card_dai_link_of(struct device_node *np, | |||
128 | if (ret) | 128 | if (ret) |
129 | return ret; | 129 | return ret; |
130 | 130 | ||
131 | ret = asoc_simple_card_parse_clk_cpu(np, dai_link, dai_props); | 131 | ret = asoc_simple_card_parse_clk_cpu(dev, np, dai_link, dai_props); |
132 | if (ret < 0) | 132 | if (ret < 0) |
133 | return ret; | 133 | return ret; |
134 | 134 | ||
@@ -153,7 +153,7 @@ static int asoc_simple_card_dai_link_of(struct device_node *np, | |||
153 | if (ret < 0) | 153 | if (ret < 0) |
154 | return ret; | 154 | return ret; |
155 | 155 | ||
156 | ret = asoc_simple_card_parse_clk_codec(np, dai_link, dai_props); | 156 | ret = asoc_simple_card_parse_clk_codec(dev, np, dai_link, dai_props); |
157 | if (ret < 0) | 157 | if (ret < 0) |
158 | return ret; | 158 | return ret; |
159 | 159 | ||