All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] usb: host: [eo]hci-plat: set hcd->phy to avoid phy_get_() in usb_add_hcd()
@ 2017-03-13  6:25 Yoshihiro Shimoda
  2017-03-13  6:25 ` [PATCH v2 1/2] usb: host: ehci-platform: set hcd->phy to avoid phy_get() " Yoshihiro Shimoda
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Yoshihiro Shimoda @ 2017-03-13  6:25 UTC (permalink / raw)
  To: stern, gregkh; +Cc: linux-usb, linux-renesas-soc, Yoshihiro Shimoda

The usb_add_hcd() will call phy_{get,init,power_on}() if hcd->phy is not set.
After the usb_add_hcd() call phy_power_on(), it keeps until usb_remove_hcd().
And then, even if the system turns suspend, the usb core keeps the phy power.
I think that each host driver should handle the phy power. So, this patch
sets hcd->phy before usb_add_hcd() to avoid phy_get() in usb_add_hcd().

Changes from v1 (as RFC):
 - Fix the usage condition about priv->phys[].
 - Remove RFC.

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

 drivers/usb/host/ehci-platform.c | 3 +++
 drivers/usb/host/ohci-platform.c | 3 +++
 2 files changed, 6 insertions(+)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 1/2] usb: host: ehci-platform: set hcd->phy to avoid phy_get() in usb_add_hcd()
  2017-03-13  6:25 [PATCH v2 0/2] usb: host: [eo]hci-plat: set hcd->phy to avoid phy_get_() in usb_add_hcd() Yoshihiro Shimoda
@ 2017-03-13  6:25 ` Yoshihiro Shimoda
  2017-03-13  6:25 ` [PATCH v2 2/2] usb: host: ohci-platform: " Yoshihiro Shimoda
  2017-03-14  1:59 ` [PATCH v2 0/2] usb: host: [eo]hci-plat: set hcd->phy to avoid phy_get_() " Alan Stern
  2 siblings, 0 replies; 4+ messages in thread
From: Yoshihiro Shimoda @ 2017-03-13  6:25 UTC (permalink / raw)
  To: stern, gregkh; +Cc: linux-usb, linux-renesas-soc, Yoshihiro Shimoda

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>
---
 drivers/usb/host/ehci-platform.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c
index a268d9e..2a7b6cb 100644
--- a/drivers/usb/host/ehci-platform.c
+++ b/drivers/usb/host/ehci-platform.c
@@ -220,6 +220,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];
 			}
 		}
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 2/2] usb: host: ohci-platform: set hcd->phy to avoid phy_get() in usb_add_hcd()
  2017-03-13  6:25 [PATCH v2 0/2] usb: host: [eo]hci-plat: set hcd->phy to avoid phy_get_() in usb_add_hcd() Yoshihiro Shimoda
  2017-03-13  6:25 ` [PATCH v2 1/2] usb: host: ehci-platform: set hcd->phy to avoid phy_get() " Yoshihiro Shimoda
@ 2017-03-13  6:25 ` Yoshihiro Shimoda
  2017-03-14  1:59 ` [PATCH v2 0/2] usb: host: [eo]hci-plat: set hcd->phy to avoid phy_get_() " Alan Stern
  2 siblings, 0 replies; 4+ messages in thread
From: Yoshihiro Shimoda @ 2017-03-13  6:25 UTC (permalink / raw)
  To: stern, gregkh; +Cc: linux-usb, linux-renesas-soc, Yoshihiro Shimoda

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>
---
 drivers/usb/host/ohci-platform.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c
index 898b740..6368fce 100644
--- a/drivers/usb/host/ohci-platform.c
+++ b/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])) {
 				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];
 			}
 		}
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 0/2] usb: host: [eo]hci-plat: set hcd->phy to avoid phy_get_() in usb_add_hcd()
  2017-03-13  6:25 [PATCH v2 0/2] usb: host: [eo]hci-plat: set hcd->phy to avoid phy_get_() in usb_add_hcd() Yoshihiro Shimoda
  2017-03-13  6:25 ` [PATCH v2 1/2] usb: host: ehci-platform: set hcd->phy to avoid phy_get() " Yoshihiro Shimoda
  2017-03-13  6:25 ` [PATCH v2 2/2] usb: host: ohci-platform: " Yoshihiro Shimoda
@ 2017-03-14  1:59 ` Alan Stern
  2 siblings, 0 replies; 4+ messages in thread
From: Alan Stern @ 2017-03-14  1:59 UTC (permalink / raw)
  To: Yoshihiro Shimoda; +Cc: gregkh, linux-usb, linux-renesas-soc

On Mon, 13 Mar 2017, Yoshihiro Shimoda wrote:

> The usb_add_hcd() will call phy_{get,init,power_on}() if hcd->phy is not set.
> After the usb_add_hcd() call phy_power_on(), it keeps until usb_remove_hcd().
> And then, even if the system turns suspend, the usb core keeps the phy power.
> I think that each host driver should handle the phy power. So, this patch
> sets hcd->phy before usb_add_hcd() to avoid phy_get() in usb_add_hcd().
> 
> Changes from v1 (as RFC):
>  - Fix the usage condition about priv->phys[].
>  - Remove RFC.
> 
> Yoshihiro Shimoda (2):
>   usb: host: ehci-platform: set hcd->phy to avoid phy_get() in
>     usb_add_hcd()
>   usb: host: ohci-platform: set hcd->phy to avoid phy_get() in
>     usb_add_hcd()
> 
>  drivers/usb/host/ehci-platform.c | 3 +++
>  drivers/usb/host/ohci-platform.c | 3 +++
>  2 files changed, 6 insertions(+)

For both patches:

Acked-by: Alan Stern <stern@rowland.harvard.edu>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-03-14  1:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-13  6:25 [PATCH v2 0/2] usb: host: [eo]hci-plat: set hcd->phy to avoid phy_get_() in usb_add_hcd() Yoshihiro Shimoda
2017-03-13  6:25 ` [PATCH v2 1/2] usb: host: ehci-platform: set hcd->phy to avoid phy_get() " Yoshihiro Shimoda
2017-03-13  6:25 ` [PATCH v2 2/2] usb: host: ohci-platform: " Yoshihiro Shimoda
2017-03-14  1:59 ` [PATCH v2 0/2] usb: host: [eo]hci-plat: set hcd->phy to avoid phy_get_() " Alan Stern

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.