Browse Source

usb: host: ohci-platform: set hcd->phy to avoid phy_get() in usb_add_hcd()

This patch sets hcd->phy from own phy context to avoid phy_get()
in usb_add_hcd(). Since core/hcd.c manages the phy only in
usb_add_hcd() and usb_remove_hcd(), there is difficult to manage
the phy in suspend/resume.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Yoshihiro Shimoda 8 years ago
parent
commit
d3d6ef1fb9
1 changed files with 3 additions and 0 deletions
  1. 3 0
      drivers/usb/host/ohci-platform.c

+ 3 - 0
drivers/usb/host/ohci-platform.c

@@ -183,6 +183,9 @@ static int ohci_platform_probe(struct platform_device *dev)
 			if (IS_ERR(priv->phys[phy_num])) {
 			if (IS_ERR(priv->phys[phy_num])) {
 				err = PTR_ERR(priv->phys[phy_num]);
 				err = PTR_ERR(priv->phys[phy_num]);
 				goto err_put_hcd;
 				goto err_put_hcd;
+			} else if (!hcd->phy) {
+				/* Avoiding phy_get() in usb_add_hcd() */
+				hcd->phy = priv->phys[phy_num];
 			}
 			}
 		}
 		}