usb: host: ehci-platform: set hcd->phy to avoid phy_get() in usb_add_hcd()
authorYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Mon, 13 Mar 2017 06:25:23 +0000 (15:25 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 Mar 2017 04:35:25 +0000 (13:35 +0900)
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>
drivers/usb/host/ehci-platform.c

index 3214300396a0d7d7506e36c9e49f9e1a3988c061..bc7b9be12f540cb22dc3a5e9ab93aa49f4c722ef 100644 (file)
@@ -221,6 +221,9 @@ static int ehci_platform_probe(struct platform_device *dev)
                        if (IS_ERR(priv->phys[phy_num])) {
                                err = PTR_ERR(priv->phys[phy_num]);
                                        goto err_put_hcd;
+                       } else if (!hcd->phy) {
+                               /* Avoiding phy_get() in usb_add_hcd() */
+                               hcd->phy = priv->phys[phy_num];
                        }
                }