aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/generic/simple-card.c
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2014-09-10 00:37:57 -0400
committerMark Brown <broonie@kernel.org>2014-09-12 09:59:48 -0400
commitf531913f01a07253d013a9c67a80df11154e7ae2 (patch)
tree8bc450befa6cd36eecff67dec55b6eccbb13e1a8 /sound/soc/generic/simple-card.c
parent88a60e552f114ae34796604575239fb196658067 (diff)
ASoC: simple-card: tidyup use priv in parameter
priv has many information about simple-card driver. Using it becomes easy to extend feature. This patch gets dev from priv as 1st step Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/generic/simple-card.c')
-rw-r--r--sound/soc/generic/simple-card.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 106fdada8640..28aa5e2d859d 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -28,6 +28,8 @@ struct simple_card_data {
28 struct snd_soc_dai_link dai_link[]; /* dynamically allocated */ 28 struct snd_soc_dai_link dai_link[]; /* dynamically allocated */
29}; 29};
30 30
31#define simple_priv_to_dev(priv) ((priv)->snd_card.dev)
32
31static int asoc_simple_card_hw_params(struct snd_pcm_substream *substream, 33static int asoc_simple_card_hw_params(struct snd_pcm_substream *substream,
32 struct snd_pcm_hw_params *params) 34 struct snd_pcm_hw_params *params)
33{ 35{
@@ -170,11 +172,12 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
170} 172}
171 173
172static int asoc_simple_card_dai_link_of(struct device_node *node, 174static int asoc_simple_card_dai_link_of(struct device_node *node,
173 struct device *dev, 175 struct simple_card_data *priv,
174 struct snd_soc_dai_link *dai_link, 176 struct snd_soc_dai_link *dai_link,
175 struct simple_dai_props *dai_props, 177 struct simple_dai_props *dai_props,
176 bool is_top_level_node) 178 bool is_top_level_node)
177{ 179{
180 struct device *dev = simple_priv_to_dev(priv);
178 struct device_node *np = NULL; 181 struct device_node *np = NULL;
179 struct device_node *bitclkmaster = NULL; 182 struct device_node *bitclkmaster = NULL;
180 struct device_node *framemaster = NULL; 183 struct device_node *framemaster = NULL;
@@ -319,9 +322,9 @@ dai_link_of_err:
319} 322}
320 323
321static int asoc_simple_card_parse_of(struct device_node *node, 324static int asoc_simple_card_parse_of(struct device_node *node,
322 struct simple_card_data *priv, 325 struct simple_card_data *priv)
323 struct device *dev)
324{ 326{
327 struct device *dev = simple_priv_to_dev(priv);
325 struct snd_soc_dai_link *dai_link = priv->snd_card.dai_link; 328 struct snd_soc_dai_link *dai_link = priv->snd_card.dai_link;
326 struct simple_dai_props *dai_props = priv->dai_props; 329 struct simple_dai_props *dai_props = priv->dai_props;
327 u32 val; 330 u32 val;
@@ -364,7 +367,7 @@ static int asoc_simple_card_parse_of(struct device_node *node,
364 367
365 for_each_child_of_node(node, np) { 368 for_each_child_of_node(node, np) {
366 dev_dbg(dev, "\tlink %d:\n", i); 369 dev_dbg(dev, "\tlink %d:\n", i);
367 ret = asoc_simple_card_dai_link_of(np, dev, 370 ret = asoc_simple_card_dai_link_of(np, priv,
368 dai_link + i, 371 dai_link + i,
369 dai_props + i, 372 dai_props + i,
370 false); 373 false);
@@ -376,7 +379,7 @@ static int asoc_simple_card_parse_of(struct device_node *node,
376 } 379 }
377 } else { 380 } else {
378 /* For single DAI link & old style of DT node */ 381 /* For single DAI link & old style of DT node */
379 ret = asoc_simple_card_dai_link_of(node, dev, 382 ret = asoc_simple_card_dai_link_of(node, priv,
380 dai_link, dai_props, true); 383 dai_link, dai_props, true);
381 if (ret < 0) 384 if (ret < 0)
382 return ret; 385 return ret;
@@ -446,7 +449,7 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
446 449
447 if (np && of_device_is_available(np)) { 450 if (np && of_device_is_available(np)) {
448 451
449 ret = asoc_simple_card_parse_of(np, priv, dev); 452 ret = asoc_simple_card_parse_of(np, priv);
450 if (ret < 0) { 453 if (ret < 0) {
451 if (ret != -EPROBE_DEFER) 454 if (ret != -EPROBE_DEFER)
452 dev_err(dev, "parse error %d\n", ret); 455 dev_err(dev, "parse error %d\n", ret);