Hi,

On Wed, Oct 31, 2012 at 04:12:43PM +0100, Sebastian Andrzej Siewior wrote:
> 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.
> 
> Cc: B, Ravi <ravib...@ti.com>
> Cc: Ajay Kumar Gupta <ajay.gu...@ti.com>
> Cc: Santhapuri, Damodar <damodar.santhap...@ti.com>
> Cc: Mian Yousaf Kaukab <mian.yousaf.kau...@stericsson.com>
> Cc: Bob Liu <lliu...@gmail.com>
> Signed-off-by: Sebastian Andrzej Siewior <bige...@linutronix.de>

still not applying:

$ patch -p1 --dry-run < ~/musb_patch.diff
patching file drivers/usb/musb/am35x.c
Hunk #1 succeeded at 459 (offset -6 lines).
Hunk #2 succeeded at 466 (offset -6 lines).
Hunk #3 succeeded at 498 (offset -6 lines).
Hunk #4 succeeded at 547 (offset -6 lines).
Hunk #5 succeeded at 558 (offset -6 lines).
patching file drivers/usb/musb/blackfin.c
patching file drivers/usb/musb/da8xx.c
patching file drivers/usb/musb/davinci.c
patching file drivers/usb/musb/musb_core.c
patching file drivers/usb/musb/musb_core.h
patching file drivers/usb/musb/musb_dsps.c
Hunk #1 FAILED at 459.
1 out of 5 hunks FAILED -- saving rejects to file 
drivers/usb/musb/musb_dsps.c.rej
patching file drivers/usb/musb/omap2430.c
patching file drivers/usb/musb/tusb6010.c
patching file drivers/usb/musb/ux500.c
Hunk #1 FAILED at 65.
1 out of 5 hunks FAILED -- saving rejects to file drivers/usb/musb/ux500.c.rej

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:

commit 5f62bc302ec55c0bd1bce01630eb05559a9b0b02
Author: Sebastian Andrzej Siewior <bige...@linutronix.de>
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.

    [ ba...@ti.com : fixed up two failed hunks when applying patch ]
    
    Cc: B, Ravi <ravib...@ti.com>
    Cc: Santhapuri, Damodar <damodar.santhap...@ti.com>
    Cc: Mian Yousaf Kaukab <mian.yousaf.kau...@stericsson.com>
    Cc: Bob Liu <lliu...@gmail.com>
    Signed-off-by: Sebastian Andrzej Siewior <bige...@linutronix.de>
    Signed-off-by: Felipe Balbi <ba...@ti.com>

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);

-- 
balbi

Attachment: signature.asc
Description: Digital signature

Reply via email to