Re: [PATCH v2] usb/musb: remove hand-crafted id handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/01/2012 11:30 AM, Felipe Balbi wrote:
Hi,

Hi,

For -rc we have a fix for the musbid stuff, which isn't available on my
musb branch. I have fixed this one myself, here's final patch below,
please check that it looks ok for you:

ah okay. I took your master branch. This patch here shows only two out
of ten files. I guess this are the files you modified. So far it looks
okay.
Remember: once you merge your branches together you should remove
musbid from ux500. However you might be lucky and it will clash now
because you removed the one blank line (on the other hand git might
want to auto merge this).

commit 5f62bc302ec55c0bd1bce01630eb05559a9b0b02
Author: Sebastian Andrzej Siewior<bigeasy@xxxxxxxxxxxxx>
Date:   Wed Oct 31 16:12:43 2012 +0100

     usb: musb: remove hand-crafted id handling

     This replaced the handcrafted id handling by the PLATFORM_DEVID_AUTO
     value which should do the same thing.

     This patch probably also fixes ux500 because I did not find the "musbid"
     variable to remove. And we close a tiny-unlikely race window becuase the
     old code gave the id back before device was destroyed in the remove
     case.

     [ balbi@xxxxxx : fixed up two failed hunks when applying patch ]

     Cc: B, Ravi<ravibabu@xxxxxx>
     Cc: Santhapuri, Damodar<damodar.santhapuri@xxxxxx>
     Cc: Mian Yousaf Kaukab<mian.yousaf.kaukab@xxxxxxxxxxxxxx>
     Cc: Bob Liu<lliubbo@xxxxxxxxx>
     Signed-off-by: Sebastian Andrzej Siewior<bigeasy@xxxxxxxxxxxxx>
     Signed-off-by: Felipe Balbi<balbi@xxxxxx>

diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 828d2a2..2d2cd37 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -459,7 +459,7 @@ static int __devinit dsps_create_musb_pdev(struct dsps_glue *glue, u8 id)
  	struct resource *res;
  	struct resource	resources[2];
  	char res_name[10];
-	int ret, musbid;
+	int ret;

  	/* get memory resource */
  	sprintf(res_name, "musb%d", id);
@@ -484,22 +484,14 @@ static int __devinit dsps_create_musb_pdev(struct dsps_glue *glue, u8 id)
  	resources[1] = *res;
  	resources[1].name = "mc";

-	/* get the musb id */
-	musbid = musb_get_id(dev, GFP_KERNEL);
-	if (musbid<  0) {
-		dev_err(dev, "failed to allocate musb id\n");
-		ret = -ENOMEM;
-		goto err0;
-	}
  	/* allocate the child platform device */
-	musb = platform_device_alloc("musb-hdrc", musbid);
+	musb = platform_device_alloc("musb-hdrc", PLATFORM_DEVID_AUTO);
  	if (!musb) {
  		dev_err(dev, "failed to allocate musb device\n");
  		ret = -ENOMEM;
-		goto err1;
+		goto err0;
  	}

-	musb->id			= musbid;
  	musb->dev.parent		= dev;
  	musb->dev.dma_mask		=&musb_dmamask;
  	musb->dev.coherent_dma_mask	= musb_dmamask;
@@ -556,18 +548,10 @@ static int __devinit dsps_create_musb_pdev(struct dsps_glue *glue, u8 id)

  err2:
  	platform_device_put(musb);
-err1:
-	musb_put_id(dev, musbid);
  err0:
  	return ret;
  }

-static void dsps_delete_musb_pdev(struct dsps_glue *glue, u8 id)
-{
-	musb_put_id(glue->dev, glue->musb[id]->id);
-	platform_device_unregister(glue->musb[id]);
-}
-
  static int __devinit dsps_probe(struct platform_device *pdev)
  {
  	struct device_node *np = pdev->dev.of_node;
@@ -627,7 +611,7 @@ static int __devinit dsps_probe(struct platform_device *pdev)
  			dev_err(&pdev->dev, "failed to create child pdev\n");
  			/* release resources of previously created instances */
  			for (i--; i>= 0 ; i--)
-				dsps_delete_musb_pdev(glue, i);
+				platform_device_unregister(glue->musb[i]);
  			goto err3;
  		}
  	}
@@ -652,7 +636,7 @@ static int __devexit dsps_remove(struct platform_device *pdev)

  	/* delete the child platform device */
  	for (i = 0; i<  wrp->instances ; i++)
-		dsps_delete_musb_pdev(glue, i);
+		platform_device_unregister(glue->musb[i]);

  	/* disable usbss clocks */
  	pm_runtime_put(&pdev->dev);
diff --git a/drivers/usb/musb/ux500.c b/drivers/usb/musb/ux500.c
index 4197f30..5e9053e 100644
--- a/drivers/usb/musb/ux500.c
+++ b/drivers/usb/musb/ux500.c
@@ -65,7 +65,6 @@ static int __devinit ux500_probe(struct platform_device *pdev)
  	struct platform_device		*musb;
  	struct ux500_glue		*glue;
  	struct clk			*clk;
-
  	int				ret = -ENOMEM;

  	glue = kzalloc(sizeof(*glue), GFP_KERNEL);
@@ -74,18 +73,10 @@ static int __devinit ux500_probe(struct platform_device *pdev)
  		goto err0;
  	}

-	/* get the musb id */
-	musbid = musb_get_id(&pdev->dev, GFP_KERNEL);
-	if (musbid<  0) {
-		dev_err(&pdev->dev, "failed to allocate musb id\n");
-		ret = -ENOMEM;
-		goto err1;
-	}
-
-	musb = platform_device_alloc("musb-hdrc", musbid);
+	musb = platform_device_alloc("musb-hdrc", PLATFORM_DEVID_AUTO);
  	if (!musb) {
  		dev_err(&pdev->dev, "failed to allocate musb device\n");
-		goto err2;
+		goto err1;
  	}

  	clk = clk_get(&pdev->dev, "usb");
@@ -101,7 +92,6 @@ static int __devinit ux500_probe(struct platform_device *pdev)
  		goto err4;
  	}

-	musb->id			= musbid;
  	musb->dev.parent		=&pdev->dev;
  	musb->dev.dma_mask		= pdev->dev.dma_mask;
  	musb->dev.coherent_dma_mask	= pdev->dev.coherent_dma_mask;
@@ -144,9 +134,6 @@ err4:
  err3:
  	platform_device_put(musb);

-err2:
-	musb_put_id(&pdev->dev, musbid);
-
  err1:
  	kfree(glue);

@@ -158,7 +145,6 @@ static int __devexit ux500_remove(struct platform_device *pdev)
  {
  	struct ux500_glue	*glue = platform_get_drvdata(pdev);

-	musb_put_id(&pdev->dev, glue->musb->id);
  	platform_device_unregister(glue->musb);
  	clk_disable(glue->clk);
  	clk_put(glue->clk);


Sebastian
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux