Skip to contentSkip to conversation

asoc/multi-component: mpc8610: replace of_device with platform_device

PATCH In review Timur Tabi 4 participants 9 messages Aug 19, 2010 – Aug 20, 2010

Subsystems (3)
lore
Share & tools
lore

Timur Tabi

author
#0 lore raw

PATCH 1/1 asoc/multi-component: mpc8610: replace of_device with platform_device

'struct of_device' no longer exists, and its functionality has been merged into platform_device. Update the MPC8610 HPCD audio drivers (fsl_ssi, fsl_dma, and mpc8610_hpcd) accordingly.

Also add a #include for slab.h, which is now needed for kmalloc and kfree.

---
 sound/soc/fsl/fsl_dma.c      |   23 ++++++++++++-----------
 sound/soc/fsl/fsl_ssi.c      |   42 +++++++++++++++++++++---------------------
 sound/soc/fsl/mpc8610_hpcd.c |   10 ++++++----
 3 files changed, 39 insertions(+), 36 deletions(-)
sound/soc/fsl/fsl_dma.c +12 -11
index dfe1cb9..cb78698 100644
@@ -23,6 +23,7 @@
 #include <linux/gfp.h>
 #include <linux/of_platform.h>
 #include <linux/list.h>
+#include <linux/slab.h>
 
 #include <sound/core.h>
 #include <sound/pcm.h>
@@ -887,11 +888,11 @@ static struct snd_pcm_ops fsl_dma_ops = {
 	.pointer	= fsl_dma_pointer,
 };
 
-static int __devinit fsl_soc_dma_probe(struct of_device *of_dev,
+static int __devinit fsl_soc_dma_probe(struct platform_device *pdev,
 				       const struct of_device_id *match)
  {
 	struct dma_object *dma;
-	struct device_node *np = of_dev->dev.of_node;
+	struct device_node *np = pdev->dev.of_node;
 	struct device_node *ssi_np;
 	struct resource res;
 	const uint32_t *iprop;
@@ -900,13 +901,13 @@ static int __devinit fsl_soc_dma_probe(struct of_device *of_dev,
 	/* Find the SSI node that points to us. */
 	ssi_np = find_ssi_node(np);
 	if (!ssi_np) {
-		dev_err(&of_dev->dev, "cannot find parent SSI node\n");
+		dev_err(&pdev->dev, "cannot find parent SSI node\n");
 		return -ENODEV;
 	}
 
 	ret = of_address_to_resource(ssi_np, 0, &res);
 	if (ret) {
-		dev_err(&of_dev->dev, "could not determine resources for %s\n",
+		dev_err(&pdev->dev, "could not determine resources for %s\n",
 			ssi_np->full_name);
 		of_node_put(ssi_np);
 		return ret;
@@ -914,7 +915,7 @@ static int __devinit fsl_soc_dma_probe(struct of_device *of_dev,
 
 	dma = kzalloc(sizeof(*dma) + strlen(np->full_name), GFP_KERNEL);
 	if (!dma) {
-		dev_err(&of_dev->dev, "could not allocate dma object\n");
+		dev_err(&pdev->dev, "could not allocate dma object\n");
 		of_node_put(ssi_np);
 		return -ENOMEM;
 	}
@@ -937,9 +938,9 @@ static int __devinit fsl_soc_dma_probe(struct of_device *of_dev,
 
 	of_node_put(ssi_np);
 
-	ret = snd_soc_register_platform(&of_dev->dev, &dma->dai);
+	ret = snd_soc_register_platform(&pdev->dev, &dma->dai);
 	if (ret) {
-		dev_err(&of_dev->dev, "could not register platform\n");
+		dev_err(&pdev->dev, "could not register platform\n");
 		kfree(dma);
 		return ret;
 	}
@@ -947,16 +948,16 @@ static int __devinit fsl_soc_dma_probe(struct of_device *of_dev,
 	dma->channel = of_iomap(np, 0);
 	dma->irq = irq_of_parse_and_map(np, 0);
 
-	dev_set_drvdata(&of_dev->dev, dma);
+	dev_set_drvdata(&pdev->dev, dma);
 
 	return 0;
 }
 
-static int __devexit fsl_soc_dma_remove(struct of_device *of_dev)
+static int __devexit fsl_soc_dma_remove(struct platform_device *pdev)
 {
-	struct dma_object *dma = dev_get_drvdata(&of_dev->dev);
+	struct dma_object *dma = dev_get_drvdata(&pdev->dev);
 
-	snd_soc_unregister_platform(&of_dev->dev);
+	snd_soc_unregister_platform(&pdev->dev);
 	iounmap(dma->channel);
 	irq_dispose_mapping(dma->irq);
 	kfree(dma);
sound/soc/fsl/fsl_ssi.c +21 -21

117 lines not on this page · raw message

sound/soc/fsl/mpc8610_hpcd.c +6 -4
index 38339c1..0d7dcf1 100644
@@ -13,6 +13,7 @@
 #include <linux/module.h>
 #include <linux/interrupt.h>
 #include <linux/of_device.h>
+#include <linux/slab.h>
 #include <sound/soc.h>
 #include <asm/fsl_guts.h>
 
@@ -323,9 +324,10 @@ static int get_dma_channel(struct device_node *ssi_np,
 static int mpc8610_hpcd_probe(struct platform_device *pdev)
 {
 	struct device *dev = pdev->dev.parent;
-	/* of_dev is the OF device for the SSI node that probed us */
-	struct of_device *of_dev = container_of(dev, struct of_device, dev);
-	struct device_node *np = of_dev->dev.of_node;
+	/* ssi_pdev is the platform device for the SSI node that probed us */
+	struct platform_device *ssi_pdev =
+		container_of(dev, struct platform_device, dev);
+	struct device_node *np = ssi_pdev->dev.of_node;
 	struct device_node *codec_np = NULL;
 	struct platform_device *sound_device = NULL;
 	struct mpc8610_hpcd_data *machine_data;
@@ -348,7 +350,7 @@ static int mpc8610_hpcd_probe(struct platform_device *pdev)
 	if (!machine_data)
 		return -ENOMEM;
 
-	machine_data->dai[0].cpu_dai_name = dev_name(&of_dev->dev);
+	machine_data->dai[0].cpu_dai_name = dev_name(&ssi_pdev->dev);
 	machine_data->dai[0].ops = &mpc8610_hpcd_ops;
 
 	/* Determine the codec name, it will be used as the codec DAI name */
Signature · 1 line
1.7.0.1
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Timur Tabi

'struct of_device' no longer exists, and its functionality has been merged into platform_device. Update the MPC8610 HPCD audio drivers (fsl_ssi, fsl_dma, and mpc8610_hpcd) accordingly.

Also add a #include for slab.h, which is now needed for kmalloc and kfree.

Signature · 3 lines
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk
#2 lore raw
In reply to Timur Tabi
Quoted 7 lines · Timur Tabi

'struct of_device' no longer exists, and its functionality has been merged into platform_device. Update the MPC8610 HPCD audio drivers (fsl_ssi, fsl_dma, and mpc8610_hpcd) accordingly.

Also add a #include for slab.h, which is now needed for kmalloc and kfree.

This doesn't apply against current for-2.6.37 (presumably as a result of the merge up of 2.6.36-rc1) - could you check please?

#3 lore raw

I based it off the for-2.6.37 branch, so it has to apply as is. Can you tell me where the conflict is?

Quoted 12 lines · Mark Brown
Quoted 7 lines · Timur Tabi

'struct of_device' no longer exists, and its functionality has been merged into platform_device. Update the MPC8610 HPCD audio drivers (fsl_ssi, fsl_dma, and mpc8610_hpcd) accordingly.

Also add a #include for slab.h, which is now needed for kmalloc and kfree.

This doesn't apply against current for-2.6.37 (presumably as a result of the merge up of 2.6.36-rc1) - could you check please?

#4 lore raw
Quoted 2 lines · On Fri, Aug 20, 2010 at 07:43:57AM -0500, Tabi Timur-B04825 wrote:

I based it off the for-2.6.37 branch, so it has to apply as is. Can you tell me where the conflict is?

This is the result of an attempt to apply with a 3 way merge:

sound/soc/fsl/fsl_dma.c +0 -0
diff --cc sound/soc/fsl/fsl_dma.c
index 5a6f56d,cb78698..0000000
@@@ -876,9 -892,10 +877,9 @@@ static int __devinit fsl_soc_dma_probe(
  				       const struct of_device_id *match)
   {
  	struct dma_object *dma;
- 	struct device_node *np = of_dev->dev.of_node;
+ 	struct device_node *np = pdev->dev.of_node;
  	struct device_node *ssi_np;
  	struct resource res;
 -	const uint32_t *iprop;
  	int ret;
  
  	/* Find the SSI node that points to us. */
@@@ -889,15 -906,17 +890,26 @@@
  	}
  
  	ret = of_address_to_resource(ssi_np, 0, &res);
 +	of_node_put(ssi_np);
  	if (ret) {
++<<<<<<< HEAD
 +		dev_err(&of_dev->dev, "could not determine device resources\n");
++=======
+ 		dev_err(&pdev->dev, "could not determine resources for %s\n",
+ 			ssi_np->full_name);
+ 		of_node_put(ssi_np);
++>>>>>>> asoc/multi-component: mpc8610: replace of_device with platform_device
  		return ret;
  	}
  
  	dma = kzalloc(sizeof(*dma) + strlen(np->full_name), GFP_KERNEL);
  	if (!dma) {
++<<<<<<< HEAD
 +		dev_err(&of_dev->dev, "could not allocate dma object\n");
++=======
+ 		dev_err(&pdev->dev, "could not allocate dma object\n");
+ 		of_node_put(ssi_np);
++>>>>>>> asoc/multi-component: mpc8610: replace of_device with platform_device
  		return -ENOMEM;
  	}
  
@@@ -910,9 -929,18 +922,22 @@@
  	dma->ssi_stx_phys = res.start + offsetof(struct ccsr_ssi, stx0);
  	dma->ssi_srx_phys = res.start + offsetof(struct ccsr_ssi, srx0);
  
++<<<<<<< HEAD
 +	ret = snd_soc_register_platform(&of_dev->dev, &dma->dai);
++=======
+ 	iprop = of_get_property(ssi_np, "fsl,fifo-depth", NULL);
+ 	if (iprop)
+ 		dma->ssi_fifo_depth = *iprop;
+ 	else
+                 /* Older 8610 DTs didn't have the fifo-depth property */
+ 		dma->ssi_fifo_depth = 8;
+ 
+ 	of_node_put(ssi_np);
+ 
+ 	ret = snd_soc_register_platform(&pdev->dev, &dma->dai);
++>>>>>>> asoc/multi-component: mpc8610: replace of_device with platform_device
  	if (ret) {
- 		dev_err(&of_dev->dev, "could not register platform\n");
+ 		dev_err(&pdev->dev, "could not register platform\n");
  		kfree(dma);
  		return ret;
  	}
author
#5 lore raw
In reply to Mark Brown
Quoted 11 lines · Mark Brown
Quoted 7 lines · Timur Tabi

'struct of_device' no longer exists, and its functionality has been merged into platform_device.  Update the MPC8610 HPCD audio drivers (fsl_ssi, fsl_dma, and mpc8610_hpcd) accordingly.

Also add a #include for slab.h, which is now needed for kmalloc and kfree.

This doesn't apply against current for-2.6.37 (presumably as a result of the merge up of 2.6.36-rc1) - could you check please?

I believe that this is because you are missing this patch:

[v2] asoc/multi-component: fsl: add support for variable SSI FIFO depth

Liam, would you please ask Mark to pull from your for-2.6.37 branch, so that he can pick up this patch?

Signature · 2 lines
Timur Tabi
Linux kernel developer at Freescale
#6 lore raw
Quoted 14 lines · Timur Tabi
Quoted 11 lines · Mark Brown
Quoted 7 lines · Timur Tabi

'struct of_device' no longer exists, and its functionality has been merged into platform_device. Update the MPC8610 HPCD audio drivers (fsl_ssi, fsl_dma, and mpc8610_hpcd) accordingly.

Also add a #include for slab.h, which is now needed for kmalloc and kfree.

This doesn't apply against current for-2.6.37 (presumably as a result of the merge up of 2.6.36-rc1) - could you check please?

Quoted 6 lines

I believe that this is because you are missing this patch:

[v2] asoc/multi-component: fsl: add support for variable SSI FIFO depth

Liam, would you please ask Mark to pull from your for-2.6.37 branch, so that he can pick up this patch?

Mark has pulled and has this patch now. Btw, the confusion here was in the patch subject (multi-component) hence this mornings email on the matter.

Thanks

Liam

Signature · 3 lines
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk
#7 lore raw
Quoted 4 lines · Liam Girdwood
Quoted 1 line · Timur Tabi

I believe that this is because you are missing this patch:

Quoted 8 lines
Quoted 4 lines

[v2] asoc/multi-component: fsl: add support for variable SSI FIFO depth

Liam, would you please ask Mark to pull from your for-2.6.37 branch, so that he can pick up this patch?

Mark has pulled and has this patch now. Btw, the confusion here was in the patch subject (multi-component) hence this mornings email on the matter.

This sorted the application issue, applied now.

author
#8 lore raw
Quoted 4 lines · Mark Brown
Quoted 3 lines
Quoted 3 lines

Mark has pulled and has this patch now. Btw, the confusion here was in the patch subject (multi-component) hence this mornings email on the matter.

This sorted the application issue, applied now.

Ok, this wraps up all my work for mpc8610 and p1022 audio. Thanks, guys. I know I was a bit prissy every now and then, so I appreciate your putting up with me these last four months.