diff mbox series

[v2,04/12] ASoC: qdsp6: q6adm: use of_platform_populate/depopulate()

Message ID 20180626092016.9296-5-srinivas.kandagatla@linaro.org
State Accepted
Commit f614c9b070ed149bbaac4edefb2b5fcb7755c4b0
Headers show
Series ASoC: qdsp6: Fix dt based module loading and minor fixes | expand

Commit Message

Srinivas Kandagatla June 26, 2018, 9:20 a.m. UTC
Now that the child nodes have there own compatible strings,
Use of_platform_populate/depopulate() instead of less common
of_platform_device_create()/destroy().

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

---
 sound/soc/qcom/qdsp6/q6adm.c | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)

-- 
2.16.2

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

Comments

Niklas Cassel June 26, 2018, 9:30 a.m. UTC | #1
Acked-by: Niklas Cassel <niklas.cassel@linaro.org>


On Tue, Jun 26, 2018 at 10:20:08AM +0100, Srinivas Kandagatla wrote:
> Now that the child nodes have there own compatible strings,

> Use of_platform_populate/depopulate() instead of less common

> of_platform_device_create()/destroy().

> 

> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

> ---

>  sound/soc/qcom/qdsp6/q6adm.c | 16 ++--------------

>  1 file changed, 2 insertions(+), 14 deletions(-)

> 

> diff --git a/sound/soc/qcom/qdsp6/q6adm.c b/sound/soc/qcom/qdsp6/q6adm.c

> index 9983c665a941..932c3ebfd252 100644

> --- a/sound/soc/qcom/qdsp6/q6adm.c

> +++ b/sound/soc/qcom/qdsp6/q6adm.c

> @@ -64,7 +64,6 @@ struct q6adm {

>  	struct aprv2_ibasic_rsp_result_t result;

>  	struct mutex lock;

>  	wait_queue_head_t matrix_map_wait;

> -	struct platform_device *pdev_routing;

>  };

>  

>  struct q6adm_cmd_device_open_v5 {

> @@ -588,7 +587,6 @@ EXPORT_SYMBOL_GPL(q6adm_close);

>  static int q6adm_probe(struct apr_device *adev)

>  {

>  	struct device *dev = &adev->dev;

> -	struct device_node *dais_np;

>  	struct q6adm *adm;

>  

>  	adm = devm_kzalloc(&adev->dev, sizeof(*adm), GFP_KERNEL);

> @@ -605,22 +603,12 @@ static int q6adm_probe(struct apr_device *adev)

>  	INIT_LIST_HEAD(&adm->copps_list);

>  	spin_lock_init(&adm->copps_list_lock);

>  

> -	dais_np = of_get_child_by_name(dev->of_node, "routing");

> -	if (dais_np) {

> -		adm->pdev_routing = of_platform_device_create(dais_np,

> -							   "q6routing", dev);

> -		of_node_put(dais_np);

> -	}

> -

> -	return 0;

> +	return of_platform_populate(dev->of_node, NULL, NULL, dev);

>  }

>  

>  static int q6adm_remove(struct apr_device *adev)

>  {

> -	struct q6adm *adm = dev_get_drvdata(&adev->dev);

> -

> -	if (adm->pdev_routing)

> -		of_platform_device_destroy(&adm->pdev_routing->dev, NULL);

> +	of_platform_depopulate(&adev->dev);

>  

>  	return 0;

>  }

> -- 

> 2.16.2

> 

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
diff mbox series

Patch

diff --git a/sound/soc/qcom/qdsp6/q6adm.c b/sound/soc/qcom/qdsp6/q6adm.c
index 9983c665a941..932c3ebfd252 100644
--- a/sound/soc/qcom/qdsp6/q6adm.c
+++ b/sound/soc/qcom/qdsp6/q6adm.c
@@ -64,7 +64,6 @@  struct q6adm {
 	struct aprv2_ibasic_rsp_result_t result;
 	struct mutex lock;
 	wait_queue_head_t matrix_map_wait;
-	struct platform_device *pdev_routing;
 };
 
 struct q6adm_cmd_device_open_v5 {
@@ -588,7 +587,6 @@  EXPORT_SYMBOL_GPL(q6adm_close);
 static int q6adm_probe(struct apr_device *adev)
 {
 	struct device *dev = &adev->dev;
-	struct device_node *dais_np;
 	struct q6adm *adm;
 
 	adm = devm_kzalloc(&adev->dev, sizeof(*adm), GFP_KERNEL);
@@ -605,22 +603,12 @@  static int q6adm_probe(struct apr_device *adev)
 	INIT_LIST_HEAD(&adm->copps_list);
 	spin_lock_init(&adm->copps_list_lock);
 
-	dais_np = of_get_child_by_name(dev->of_node, "routing");
-	if (dais_np) {
-		adm->pdev_routing = of_platform_device_create(dais_np,
-							   "q6routing", dev);
-		of_node_put(dais_np);
-	}
-
-	return 0;
+	return of_platform_populate(dev->of_node, NULL, NULL, dev);
 }
 
 static int q6adm_remove(struct apr_device *adev)
 {
-	struct q6adm *adm = dev_get_drvdata(&adev->dev);
-
-	if (adm->pdev_routing)
-		of_platform_device_destroy(&adm->pdev_routing->dev, NULL);
+	of_platform_depopulate(&adev->dev);
 
 	return 0;
 }