diff mbox

[PATCH/RFC,1/2] usb: host: ehci-platform: set hcd->phy to avoid phy_get() in usb_add_hcd()

Message ID 1489150886-27862-2-git-send-email-yoshihiro.shimoda.uh@renesas.com (mailing list archive)
State Superseded
Delegated to: Geert Uytterhoeven
Headers show

Commit Message

Yoshihiro Shimoda March 10, 2017, 1:01 p.m. UTC
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 <yoshihiro.shimoda.uh@renesas.com>
---
 drivers/usb/host/ehci-platform.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Alan Stern March 10, 2017, 5:16 p.m. UTC | #1
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 <yoshihiro.shimoda.uh@renesas.com>
> ---
>  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
Yoshihiro Shimoda March 13, 2017, 1:21 a.m. UTC | #2
Hi,

> From: Alan Stern
> Sent: Saturday, March 11, 2017 2:17 AM
> 
> 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 <yoshihiro.shimoda.uh@renesas.com>
> > ---
> >  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).

Oops! I will fix the issue.

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

Thank you for the comment! Anyway, I will submit v2 patch without RFC.

Best regards,
Yoshihiro Shimoda

> Alan Stern
diff mbox

Patch

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];
 
 		for (clk = 0; clk < EHCI_MAX_CLKS; clk++) {
 			priv->clks[clk] = of_clk_get(dev->dev.of_node, clk);