diff mbox

[1/3] ASoC: simple-card: tidyup use priv in parameter

Message ID 87zje8xf8d.wl%kuninori.morimoto.gx@gmail.com (mailing list archive)
State Accepted
Commit f531913f01a07253d013a9c67a80df11154e7ae2
Headers show

Commit Message

Kuninori Morimoto Sept. 10, 2014, 4:37 a.m. UTC
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

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>
---
 sound/soc/generic/simple-card.c |   15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

Comments

Mark Brown Sept. 12, 2014, 1:59 p.m. UTC | #1
On Tue, Sep 09, 2014 at 09:37:57PM -0700, Kuninori Morimoto wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> priv has many information about simple-card driver.
> Using it becomes easy to extend feature.
> This patch gets dev from priv as 1st step

Applied, thanks.
diff mbox

Patch

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 4053152..b8f3e11 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -28,6 +28,8 @@  struct simple_card_data {
 	struct snd_soc_dai_link dai_link[];	/* dynamically allocated */
 };
 
+#define simple_priv_to_dev(priv) ((priv)->snd_card.dev)
+
 static int asoc_simple_card_hw_params(struct snd_pcm_substream *substream,
 				      struct snd_pcm_hw_params *params)
 {
@@ -171,11 +173,12 @@  asoc_simple_card_sub_parse_of(struct device_node *np,
 }
 
 static int asoc_simple_card_dai_link_of(struct device_node *node,
-					struct device *dev,
+					struct simple_card_data *priv,
 					struct snd_soc_dai_link *dai_link,
 					struct simple_dai_props *dai_props,
 					bool is_top_level_node)
 {
+	struct device *dev = simple_priv_to_dev(priv);
 	struct device_node *np = NULL;
 	struct device_node *bitclkmaster = NULL;
 	struct device_node *framemaster = NULL;
@@ -318,9 +321,9 @@  dai_link_of_err:
 }
 
 static int asoc_simple_card_parse_of(struct device_node *node,
-				     struct simple_card_data *priv,
-				     struct device *dev)
+				     struct simple_card_data *priv)
 {
+	struct device *dev = simple_priv_to_dev(priv);
 	struct snd_soc_dai_link *dai_link = priv->snd_card.dai_link;
 	struct simple_dai_props *dai_props = priv->dai_props;
 	u32 val;
@@ -363,7 +366,7 @@  static int asoc_simple_card_parse_of(struct device_node *node,
 
 		for_each_child_of_node(node, np) {
 			dev_dbg(dev, "\tlink %d:\n", i);
-			ret = asoc_simple_card_dai_link_of(np, dev,
+			ret = asoc_simple_card_dai_link_of(np, priv,
 							   dai_link + i,
 							   dai_props + i,
 							   false);
@@ -375,7 +378,7 @@  static int asoc_simple_card_parse_of(struct device_node *node,
 		}
 	} else {
 		/* For single DAI link & old style of DT node */
-		ret = asoc_simple_card_dai_link_of(node, dev,
+		ret = asoc_simple_card_dai_link_of(node, priv,
 						   dai_link, dai_props, true);
 		if (ret < 0)
 			return ret;
@@ -447,7 +450,7 @@  static int asoc_simple_card_probe(struct platform_device *pdev)
 
 	if (np && of_device_is_available(np)) {
 
-		ret = asoc_simple_card_parse_of(np, priv, dev);
+		ret = asoc_simple_card_parse_of(np, priv);
 		if (ret < 0) {
 			if (ret != -EPROBE_DEFER)
 				dev_err(dev, "parse error %d\n", ret);