usb: musb: move usb_phy_generic_{un,}register calls to probe()/remove()
authorFelipe Balbi <balbi@ti.com>
Wed, 16 Apr 2014 21:05:17 +0000 (16:05 -0500)
committerFelipe Balbi <balbi@ti.com>
Mon, 21 Apr 2014 19:07:25 +0000 (14:07 -0500)
This patch is in preparation to supporting
calling those functions multiple times.

Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/musb/am35x.c
drivers/usb/musb/blackfin.c
drivers/usb/musb/da8xx.c
drivers/usb/musb/davinci.c
drivers/usb/musb/tusb6010.c

index 044cd824c70dd9312d4725dfa20c3b6195018431..05459b56b2a8caa913f4ea561eb368008a6b529f 100644 (file)
@@ -360,7 +360,6 @@ static int am35x_musb_init(struct musb *musb)
        if (!rev)
                return -ENODEV;
 
-       usb_phy_generic_register();
        musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
        if (IS_ERR_OR_NULL(musb->xceiv))
                return -EPROBE_DEFER;
@@ -402,7 +401,6 @@ static int am35x_musb_exit(struct musb *musb)
                data->set_phy_power(0);
 
        usb_put_phy(musb->xceiv);
-       usb_phy_generic_unregister();
 
        return 0;
 }
@@ -505,6 +503,7 @@ static int am35x_probe(struct platform_device *pdev)
 
        pdata->platform_ops             = &am35x_ops;
 
+       usb_phy_generic_register();
        platform_set_drvdata(pdev, glue);
 
        pinfo = am35x_dev_info;
@@ -547,6 +546,7 @@ static int am35x_remove(struct platform_device *pdev)
        struct am35x_glue       *glue = platform_get_drvdata(pdev);
 
        platform_device_unregister(glue->musb);
+       usb_phy_generic_unregister();
        clk_disable(glue->clk);
        clk_disable(glue->phy_clk);
        clk_put(glue->clk);
index c9992a2eaaa86358605333a16691b616dac49ca9..53acffe9a858404d39423118ea5a033cbfd60530 100644 (file)
@@ -401,7 +401,6 @@ static int bfin_musb_init(struct musb *musb)
        }
        gpio_direction_output(musb->config->gpio_vrsel, 0);
 
-       usb_phy_generic_register();
        musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
        if (IS_ERR_OR_NULL(musb->xceiv)) {
                gpio_free(musb->config->gpio_vrsel);
@@ -424,9 +423,8 @@ static int bfin_musb_init(struct musb *musb)
 static int bfin_musb_exit(struct musb *musb)
 {
        gpio_free(musb->config->gpio_vrsel);
-
        usb_put_phy(musb->xceiv);
-       usb_phy_generic_unregister();
+
        return 0;
 }
 
@@ -477,6 +475,7 @@ static int bfin_probe(struct platform_device *pdev)
 
        pdata->platform_ops             = &bfin_ops;
 
+       usb_phy_generic_register();
        platform_set_drvdata(pdev, glue);
 
        memset(musb_resources, 0x00, sizeof(*musb_resources) *
@@ -528,6 +527,7 @@ static int bfin_remove(struct platform_device *pdev)
        struct bfin_glue                *glue = platform_get_drvdata(pdev);
 
        platform_device_unregister(glue->musb);
+       usb_phy_generic_unregister();
        kfree(glue);
 
        return 0;
index a0dabb05de766f738690d2258cef64d0c669b6a7..024751f9b31ddffed59fde898c84bc51d4603cab 100644 (file)
@@ -418,7 +418,6 @@ static int da8xx_musb_init(struct musb *musb)
        if (!rev)
                goto fail;
 
-       usb_phy_generic_register();
        musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
        if (IS_ERR_OR_NULL(musb->xceiv)) {
                ret = -EPROBE_DEFER;
@@ -453,7 +452,6 @@ static int da8xx_musb_exit(struct musb *musb)
        phy_off();
 
        usb_put_phy(musb->xceiv);
-       usb_phy_generic_unregister();
 
        return 0;
 }
@@ -512,6 +510,7 @@ static int da8xx_probe(struct platform_device *pdev)
 
        pdata->platform_ops             = &da8xx_ops;
 
+       usb_phy_generic_register();
        platform_set_drvdata(pdev, glue);
 
        memset(musb_resources, 0x00, sizeof(*musb_resources) *
@@ -561,6 +560,7 @@ static int da8xx_remove(struct platform_device *pdev)
        struct da8xx_glue               *glue = platform_get_drvdata(pdev);
 
        platform_device_unregister(glue->musb);
+       usb_phy_generic_unregister();
        clk_disable(glue->clk);
        clk_put(glue->clk);
        kfree(glue);
index 73703545785842563614a5bae14b96c01f3c0186..de8492b06e467b0bf8f2fd7cd45715b7b38e8d9e 100644 (file)
@@ -381,7 +381,6 @@ static int davinci_musb_init(struct musb *musb)
        u32             revision;
        int             ret = -ENODEV;
 
-       usb_phy_generic_register();
        musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
        if (IS_ERR_OR_NULL(musb->xceiv)) {
                ret = -EPROBE_DEFER;
@@ -487,7 +486,6 @@ static int davinci_musb_exit(struct musb *musb)
        phy_off();
 
        usb_put_phy(musb->xceiv);
-       usb_phy_generic_unregister();
 
        return 0;
 }
@@ -545,6 +543,7 @@ static int davinci_probe(struct platform_device *pdev)
 
        pdata->platform_ops             = &davinci_ops;
 
+       usb_phy_generic_register();
        platform_set_drvdata(pdev, glue);
 
        memset(musb_resources, 0x00, sizeof(*musb_resources) *
@@ -603,6 +602,7 @@ static int davinci_remove(struct platform_device *pdev)
        struct davinci_glue             *glue = platform_get_drvdata(pdev);
 
        platform_device_unregister(glue->musb);
+       usb_phy_generic_unregister();
        clk_disable(glue->clk);
        clk_put(glue->clk);
        kfree(glue);
index 8d4a8194c8f228d37a3fb0930e8769d2a1cbecf7..e1da199c6f212947457aacc9c0861667e9872784 100644 (file)
@@ -1065,7 +1065,6 @@ static int tusb_musb_init(struct musb *musb)
        void __iomem            *sync = NULL;
        int                     ret;
 
-       usb_phy_generic_register();
        musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
        if (IS_ERR_OR_NULL(musb->xceiv))
                return -EPROBE_DEFER;
@@ -1117,7 +1116,6 @@ done:
                        iounmap(sync);
 
                usb_put_phy(musb->xceiv);
-               usb_phy_generic_unregister();
        }
        return ret;
 }
@@ -1133,7 +1131,6 @@ static int tusb_musb_exit(struct musb *musb)
        iounmap(musb->sync_va);
 
        usb_put_phy(musb->xceiv);
-       usb_phy_generic_unregister();
        return 0;
 }
 
@@ -1176,6 +1173,7 @@ static int tusb_probe(struct platform_device *pdev)
 
        pdata->platform_ops             = &tusb_ops;
 
+       usb_phy_generic_register();
        platform_set_drvdata(pdev, glue);
 
        memset(musb_resources, 0x00, sizeof(*musb_resources) *
@@ -1224,6 +1222,7 @@ static int tusb_remove(struct platform_device *pdev)
        struct tusb6010_glue            *glue = platform_get_drvdata(pdev);
 
        platform_device_unregister(glue->musb);
+       usb_phy_generic_unregister();
        kfree(glue);
 
        return 0;