Merge tag 'usb-for-v3.19' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi...
[deliverable/linux.git] / drivers / phy / phy-omap-usb2.c
index 8c842980834a2cebb40a77d31bc30f5f6ed643ae..08f2da27083779fef174c5844680e57a64718c34 100644 (file)
@@ -60,7 +60,7 @@ EXPORT_SYMBOL_GPL(omap_usb2_set_comparator);
 
 static int omap_usb_set_vbus(struct usb_otg *otg, bool enabled)
 {
-       struct omap_usb *phy = phy_to_omapusb(otg->phy);
+       struct omap_usb *phy = phy_to_omapusb(otg->usb_phy);
 
        if (!phy->comparator)
                return -ENODEV;
@@ -70,7 +70,7 @@ static int omap_usb_set_vbus(struct usb_otg *otg, bool enabled)
 
 static int omap_usb_start_srp(struct usb_otg *otg)
 {
-       struct omap_usb *phy = phy_to_omapusb(otg->phy);
+       struct omap_usb *phy = phy_to_omapusb(otg->usb_phy);
 
        if (!phy->comparator)
                return -ENODEV;
@@ -80,11 +80,9 @@ static int omap_usb_start_srp(struct usb_otg *otg)
 
 static int omap_usb_set_host(struct usb_otg *otg, struct usb_bus *host)
 {
-       struct usb_phy  *phy = otg->phy;
-
        otg->host = host;
        if (!host)
-               phy->state = OTG_STATE_UNDEFINED;
+               otg->state = OTG_STATE_UNDEFINED;
 
        return 0;
 }
@@ -92,11 +90,9 @@ static int omap_usb_set_host(struct usb_otg *otg, struct usb_bus *host)
 static int omap_usb_set_peripheral(struct usb_otg *otg,
                struct usb_gadget *gadget)
 {
-       struct usb_phy  *phy = otg->phy;
-
        otg->gadget = gadget;
        if (!gadget)
-               phy->state = OTG_STATE_UNDEFINED;
+               otg->state = OTG_STATE_UNDEFINED;
 
        return 0;
 }
@@ -255,17 +251,19 @@ static int omap_usb2_probe(struct platform_device *pdev)
                otg->set_vbus           = omap_usb_set_vbus;
        if (phy_data->flags & OMAP_USB2_HAS_START_SRP)
                otg->start_srp          = omap_usb_start_srp;
-       otg->phy                = &phy->phy;
+       otg->usb_phy            = &phy->phy;
 
        platform_set_drvdata(pdev, phy);
+       pm_runtime_enable(phy->dev);
 
        generic_phy = devm_phy_create(phy->dev, NULL, &ops, NULL);
-       if (IS_ERR(generic_phy))
+       if (IS_ERR(generic_phy)) {
+               pm_runtime_disable(phy->dev);
                return PTR_ERR(generic_phy);
+       }
 
        phy_set_drvdata(generic_phy, phy);
 
-       pm_runtime_enable(phy->dev);
        phy_provider = devm_of_phy_provider_register(phy->dev,
                        of_phy_simple_xlate);
        if (IS_ERR(phy_provider)) {
This page took 0.025774 seconds and 5 git commands to generate.