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>
This commit is contained in:
		
					parent
					
						
							
								88a60e552f
							
						
					
				
			
			
				commit
				
					
						f531913f01
					
				
			
		
					 1 changed files with 9 additions and 6 deletions
				
			
		|  | @ -28,6 +28,8 @@ struct simple_card_data { | ||||||
| 	struct snd_soc_dai_link dai_link[];	/* dynamically allocated */ | 	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, | static int asoc_simple_card_hw_params(struct snd_pcm_substream *substream, | ||||||
| 				      struct snd_pcm_hw_params *params) | 				      struct snd_pcm_hw_params *params) | ||||||
| { | { | ||||||
|  | @ -170,11 +172,12 @@ asoc_simple_card_sub_parse_of(struct device_node *np, | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static int asoc_simple_card_dai_link_of(struct device_node *node, | 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 snd_soc_dai_link *dai_link, | ||||||
| 					struct simple_dai_props *dai_props, | 					struct simple_dai_props *dai_props, | ||||||
| 					bool is_top_level_node) | 					bool is_top_level_node) | ||||||
| { | { | ||||||
|  | 	struct device *dev = simple_priv_to_dev(priv); | ||||||
| 	struct device_node *np = NULL; | 	struct device_node *np = NULL; | ||||||
| 	struct device_node *bitclkmaster = NULL; | 	struct device_node *bitclkmaster = NULL; | ||||||
| 	struct device_node *framemaster = NULL; | 	struct device_node *framemaster = NULL; | ||||||
|  | @ -319,9 +322,9 @@ dai_link_of_err: | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static int asoc_simple_card_parse_of(struct device_node *node, | static int asoc_simple_card_parse_of(struct device_node *node, | ||||||
| 				     struct simple_card_data *priv, | 				     struct simple_card_data *priv) | ||||||
| 				     struct device *dev) |  | ||||||
| { | { | ||||||
|  | 	struct device *dev = simple_priv_to_dev(priv); | ||||||
| 	struct snd_soc_dai_link *dai_link = priv->snd_card.dai_link; | 	struct snd_soc_dai_link *dai_link = priv->snd_card.dai_link; | ||||||
| 	struct simple_dai_props *dai_props = priv->dai_props; | 	struct simple_dai_props *dai_props = priv->dai_props; | ||||||
| 	u32 val; | 	u32 val; | ||||||
|  | @ -364,7 +367,7 @@ static int asoc_simple_card_parse_of(struct device_node *node, | ||||||
| 
 | 
 | ||||||
| 		for_each_child_of_node(node, np) { | 		for_each_child_of_node(node, np) { | ||||||
| 			dev_dbg(dev, "\tlink %d:\n", i); | 			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_link + i, | ||||||
| 							   dai_props + i, | 							   dai_props + i, | ||||||
| 							   false); | 							   false); | ||||||
|  | @ -376,7 +379,7 @@ static int asoc_simple_card_parse_of(struct device_node *node, | ||||||
| 		} | 		} | ||||||
| 	} else { | 	} else { | ||||||
| 		/* For single DAI link & old style of DT node */ | 		/* 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); | 						   dai_link, dai_props, true); | ||||||
| 		if (ret < 0) | 		if (ret < 0) | ||||||
| 			return ret; | 			return ret; | ||||||
|  | @ -446,7 +449,7 @@ static int asoc_simple_card_probe(struct platform_device *pdev) | ||||||
| 
 | 
 | ||||||
| 	if (np && of_device_is_available(np)) { | 	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 < 0) { | ||||||
| 			if (ret != -EPROBE_DEFER) | 			if (ret != -EPROBE_DEFER) | ||||||
| 				dev_err(dev, "parse error %d\n", ret); | 				dev_err(dev, "parse error %d\n", ret); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Kuninori Morimoto
				Kuninori Morimoto