On Fri, 10 Mar 2017, Yoshihiro Shimoda wrote:

> This patch sets hcd->phy from own phy context to avoid phy_get()
> in usb_add_hcd(). Since hcd.c manage 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 <[email protected]>
> ---
>  drivers/usb/host/ehci-platform.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/usb/host/ehci-platform.c 
> b/drivers/usb/host/ehci-platform.c
> index a268d9e..4ae27e9 100644
> --- a/drivers/usb/host/ehci-platform.c
> +++ b/drivers/usb/host/ehci-platform.c
> @@ -222,6 +222,8 @@ static int ehci_platform_probe(struct platform_device 
> *dev)
>                                       goto err_put_hcd;
>                       }
>               }
> +             /* Avoiding phy_get in usb_add_hcd() */
> +             hcd->phy = priv->phys[0];

This won't work if priv->num_phys == 0 (in that case, priv->phys 
doesn't get allocated).

Apart from this I have no objection, but other people may.

Alan Stern

Reply via email to