Suspend scenario in case of ohci bus glue was not properly handled as it was not suspending generic part of ohci controller. Calling explicitly the ohci_suspend()routine will ensure proper handling of suspend scenario.
Manjunath Goudar (10): USB: OHCI: Properly handle ohci-at91 suspend USB: OHCI: Properly handle ohci-s3c2410 suspend USB: OHCI: Properly handle ohci-da8xx suspend USB: OHCI: Properly handle ohci-ep93xx suspend USB: OHCI: Properly handle ohci-exynos suspend USB: OHCI: Properly handle ohci-omap suspend USB: OHCI: Properly handle ohci-platform suspend USB: OHCI: Properly handle ohci-pxa27x suspend USB: OHCI: Properly handle ohci-sm501 suspend USB: OHCI: Properly handle ohci-spear suspend
drivers/usb/host/ohci-at91.c | 8 ++++++-- drivers/usb/host/ohci-da8xx.c | 13 +++++++++---- drivers/usb/host/ohci-ep93xx.c | 6 +++++- drivers/usb/host/ohci-exynos.c | 3 +++ drivers/usb/host/ohci-omap.c | 11 ++++++++--- drivers/usb/host/ohci-platform.c | 6 +++++- drivers/usb/host/ohci-pxa27x.c | 6 +++++- drivers/usb/host/ohci-s3c2410.c | 3 +++ drivers/usb/host/ohci-sm501.c | 9 +++++++-- drivers/usb/host/ohci-spear.c | 10 +++++++--- 10 files changed, 58 insertions(+), 17 deletions(-)
Suspend scenario in case of ohci-at91 glue was not properly handled as it was not suspending generic part of ohci controller. Calling explicitly the ohci_suspend()routine in ohci_hcd_at91_drv_suspend() will ensure proper handling of suspend scenario.
Signed-off-by: Manjunath Goudar manjunath.goudar@linaro.org Cc: Arnd Bergmann arnd@arndb.de Cc: Alan Stern stern@rowland.harvard.edu Cc: Greg KH greg@kroah.com Cc: linux-usb@vger.kernel.org --- drivers/usb/host/ohci-at91.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index fb2f127..28400a7 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c @@ -619,8 +619,12 @@ ohci_hcd_at91_drv_suspend(struct platform_device *pdev, pm_message_t mesg) { struct usb_hcd *hcd = platform_get_drvdata(pdev); struct ohci_hcd *ohci = hcd_to_ohci(hcd); + bool do_wakeup = device_may_wakeup(&pdev->dev); + int ret;
- if (device_may_wakeup(&pdev->dev)) + ret = ohci_suspend(hcd, do_wakeup); + + if (do_wakeup) enable_irq_wake(hcd->irq);
/* @@ -637,7 +641,7 @@ ohci_hcd_at91_drv_suspend(struct platform_device *pdev, pm_message_t mesg) at91_stop_clock(); }
- return 0; + return ret; }
static int ohci_hcd_at91_drv_resume(struct platform_device *pdev)
Suspend scenario in case of ohci-s3c2410 glue was not properly handled as it was not suspending generic part of ohci controller.Calling explicitly the ohci_suspend() routine in ohci_hcd_s3c2410_drv_suspend() will ensure proper handling of suspend scenario.
Signed-off-by: Manjunath Goudar manjunath.goudar@linaro.org Cc: Arnd Bergmann arnd@arndb.de Cc: Alan Stern stern@rowland.harvard.edu Cc: Greg KH greg@kroah.com Cc: linux-usb@vger.kernel.org --- drivers/usb/host/ohci-s3c2410.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/drivers/usb/host/ohci-s3c2410.c b/drivers/usb/host/ohci-s3c2410.c index 8018bb1..2ffa693 100644 --- a/drivers/usb/host/ohci-s3c2410.c +++ b/drivers/usb/host/ohci-s3c2410.c @@ -430,6 +430,7 @@ static int ohci_hcd_s3c2410_drv_suspend(struct device *dev) struct platform_device *pdev = to_platform_device(dev); unsigned long flags; int rc = 0; + bool do_wakeup = device_may_wakeup(dev);
/* * Root hub was already suspended. Disable irq emission and @@ -445,6 +446,8 @@ static int ohci_hcd_s3c2410_drv_suspend(struct device *dev)
clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
+ rc = ohci_suspend(hcd, do_wakeup); + s3c2410_stop_hc(pdev); bail: spin_unlock_irqrestore(&ohci->lock, flags);
Suspend scenario in case of ohci-da8xx glue was not properly handled as it was not suspending generic part of ohci controller.Calling explicitly the ohci_suspend() routine in ohci_da8xx_suspend() will ensure proper handling of suspend scenario.
Signed-off-by: Manjunath Goudar manjunath.goudar@linaro.org Cc: Arnd Bergmann arnd@arndb.de Cc: Alan Stern stern@rowland.harvard.edu Cc: Greg KH greg@kroah.com Cc: linux-usb@vger.kernel.org --- drivers/usb/host/ohci-da8xx.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/host/ohci-da8xx.c b/drivers/usb/host/ohci-da8xx.c index 6aaa9c9..3b1d9bd 100644 --- a/drivers/usb/host/ohci-da8xx.c +++ b/drivers/usb/host/ohci-da8xx.c @@ -406,19 +406,24 @@ static int ohci_hcd_da8xx_drv_remove(struct platform_device *dev) }
#ifdef CONFIG_PM -static int ohci_da8xx_suspend(struct platform_device *dev, pm_message_t message) +static int ohci_da8xx_suspend(struct platform_device *pdev, + pm_message_t message) { - struct usb_hcd *hcd = platform_get_drvdata(dev); + struct usb_hcd *hcd = platform_get_drvdata(pdev); struct ohci_hcd *ohci = hcd_to_ohci(hcd); + bool do_wakeup = device_may_wakeup(&pdev->dev); + int ret;
if (time_before(jiffies, ohci->next_statechange)) msleep(5); ohci->next_statechange = jiffies;
+ ret = ohci_suspend(hcd, do_wakeup); + ohci_da8xx_clock(0); hcd->state = HC_STATE_SUSPENDED; - dev->dev.power.power_state = PMSG_SUSPEND; - return 0; + pdev->dev.power.power_state = PMSG_SUSPEND; + return ret; }
static int ohci_da8xx_resume(struct platform_device *dev)
Suspend scenario in case of ohci-ep93xx glue was not properly handled as it was not suspending generic part of ohci controller.Calling explicitly the ohci_suspend() routine in ohci_hcd_ep93xx_drv_suspend() will ensure proper handling of suspend scenario.
Signed-off-by: Manjunath Goudar manjunath.goudar@linaro.org Cc: Arnd Bergmann arnd@arndb.de Cc: Alan Stern stern@rowland.harvard.edu Cc: Greg KH greg@kroah.com Cc: linux-usb@vger.kernel.org --- drivers/usb/host/ohci-ep93xx.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/host/ohci-ep93xx.c b/drivers/usb/host/ohci-ep93xx.c index 8704e9f..7c77f61 100644 --- a/drivers/usb/host/ohci-ep93xx.c +++ b/drivers/usb/host/ohci-ep93xx.c @@ -174,13 +174,17 @@ static int ohci_hcd_ep93xx_drv_suspend(struct platform_device *pdev, pm_message_ { struct usb_hcd *hcd = platform_get_drvdata(pdev); struct ohci_hcd *ohci = hcd_to_ohci(hcd); + bool do_wakeup = device_may_wakeup(&pdev->dev); + int ret; + + ret = ohci_suspend(hcd, do_wakeup);
if (time_before(jiffies, ohci->next_statechange)) msleep(5); ohci->next_statechange = jiffies;
ep93xx_stop_hc(&pdev->dev); - return 0; + return ret; }
static int ohci_hcd_ep93xx_drv_resume(struct platform_device *pdev)
Suspend scenario in case of ohci-exynos glue was not properly handled as it was not suspending generic part of ohci controller.Calling explicitly the ohci_suspend() routine in exynos_ohci_suspend() will ensure proper handling of suspend scenario.
Signed-off-by: Manjunath Goudar manjunath.goudar@linaro.org Cc: Arnd Bergmann arnd@arndb.de Cc: Alan Stern stern@rowland.harvard.edu Cc: Greg KH greg@kroah.com Cc: linux-usb@vger.kernel.org --- drivers/usb/host/ohci-exynos.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c index 6ff830c..6ad38ee 100644 --- a/drivers/usb/host/ohci-exynos.c +++ b/drivers/usb/host/ohci-exynos.c @@ -203,6 +203,7 @@ static int exynos_ohci_suspend(struct device *dev) struct exynos_ohci_hcd *exynos_ohci = to_exynos_ohci(hcd); struct ohci_hcd *ohci = hcd_to_ohci(hcd); struct platform_device *pdev = to_platform_device(dev); + bool do_wakeup = device_may_wakeup(dev); unsigned long flags; int rc = 0;
@@ -226,6 +227,8 @@ static int exynos_ohci_suspend(struct device *dev)
exynos_ohci_phy_disable(pdev);
+ rc = ohci_suspend(hcd, do_wakeup); + clk_disable_unprepare(exynos_ohci->clk);
fail:
Suspend scenario in case of ohci-omap glue was not properly handled as it was not suspending generic part of ohci controller.Calling explicitly the ohci_suspend() routine in ohci_omap_suspend() will ensure proper handling of suspend scenario.
Signed-off-by: Manjunath Goudar manjunath.goudar@linaro.org Cc: Arnd Bergmann arnd@arndb.de Cc: Alan Stern stern@rowland.harvard.edu Cc: Greg KH greg@kroah.com Cc: linux-usb@vger.kernel.org --- drivers/usb/host/ohci-omap.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c index b900dba..a638a14 100644 --- a/drivers/usb/host/ohci-omap.c +++ b/drivers/usb/host/ohci-omap.c @@ -423,16 +423,21 @@ static int ohci_hcd_omap_drv_remove(struct platform_device *dev)
#ifdef CONFIG_PM
-static int ohci_omap_suspend(struct platform_device *dev, pm_message_t message) +static int ohci_omap_suspend(struct platform_device *pdev, pm_message_t message) { - struct ohci_hcd *ohci = hcd_to_ohci(platform_get_drvdata(dev)); + struct usb_hcd *hcd = platform_get_drvdata(pdev); + struct ohci_hcd *ohci = hcd_to_ohci(hcd); + bool do_wakeup = device_may_wakeup(&pdev->dev); + int ret;
if (time_before(jiffies, ohci->next_statechange)) msleep(5); ohci->next_statechange = jiffies;
+ ret = ohci_suspend(hcd, do_wakeup); + omap_ohci_clock_power(0); - return 0; + return ret; }
static int ohci_omap_resume(struct platform_device *dev)
Suspend scenario in case of ohci-platform glue was not properly handled as it was not suspending generic part of ohci controller.Calling explicitly the ohci_suspend() routine in ohci_platform_suspend() will ensure proper handling of suspend scenario.
Signed-off-by: Manjunath Goudar manjunath.goudar@linaro.org Cc: Arnd Bergmann arnd@arndb.de Cc: Alan Stern stern@rowland.harvard.edu Cc: Greg KH greg@kroah.com Cc: linux-usb@vger.kernel.org --- drivers/usb/host/ohci-platform.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c index bc30475..ad8cb3b 100644 --- a/drivers/usb/host/ohci-platform.c +++ b/drivers/usb/host/ohci-platform.c @@ -142,11 +142,15 @@ static int ohci_platform_suspend(struct device *dev) struct usb_ohci_pdata *pdata = dev->platform_data; struct platform_device *pdev = container_of(dev, struct platform_device, dev); + bool do_wakeup = device_may_wakeup(dev); + int ret; + + ret = ohci_suspend(hcd, do_wakeup);
if (pdata->power_suspend) pdata->power_suspend(pdev);
- return 0; + return ret; }
static int ohci_platform_resume(struct device *dev)
Suspend scenario in case of ohci-pxa27x glue was not properly handled as it was not suspending generic part of ohci controller.Calling explicitly the ohci_suspend() routine in ohci_hcd_pxa27x_drv_suspend() will ensure proper handling of suspend scenario.
Signed-off-by: Manjunath Goudar manjunath.goudar@linaro.org Cc: Arnd Bergmann arnd@arndb.de Cc: Alan Stern stern@rowland.harvard.edu Cc: Greg KH greg@kroah.com Cc: linux-usb@vger.kernel.org --- drivers/usb/host/ohci-pxa27x.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c index 3a9c01d..9dbfeb8 100644 --- a/drivers/usb/host/ohci-pxa27x.c +++ b/drivers/usb/host/ohci-pxa27x.c @@ -564,13 +564,17 @@ static int ohci_hcd_pxa27x_drv_suspend(struct device *dev) { struct usb_hcd *hcd = dev_get_drvdata(dev); struct pxa27x_ohci *ohci = to_pxa27x_ohci(hcd); + bool do_wakeup = device_may_wakeup(dev); + int ret;
if (time_before(jiffies, ohci->ohci.next_statechange)) msleep(5); ohci->ohci.next_statechange = jiffies;
+ ret = ohci_suspend(hcd, do_wakeup); + pxa27x_stop_hc(ohci, dev); - return 0; + return ret; }
static int ohci_hcd_pxa27x_drv_resume(struct device *dev)
Suspend scenario in case of ohci-sm501 glue was not properly handled as it was not suspending generic part of ohci controller.Calling explicitly the ohci_suspend() routine in ohci_sm501_suspend() will ensure proper handling of suspend scenario.
Signed-off-by: Manjunath Goudar manjunath.goudar@linaro.org Cc: Arnd Bergmann arnd@arndb.de Cc: Alan Stern stern@rowland.harvard.edu Cc: Greg KH greg@kroah.com Cc: linux-usb@vger.kernel.org --- drivers/usb/host/ohci-sm501.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/host/ohci-sm501.c b/drivers/usb/host/ohci-sm501.c index d479d5d..f4f2da0 100644 --- a/drivers/usb/host/ohci-sm501.c +++ b/drivers/usb/host/ohci-sm501.c @@ -216,14 +216,19 @@ static int ohci_hcd_sm501_drv_remove(struct platform_device *pdev) static int ohci_sm501_suspend(struct platform_device *pdev, pm_message_t msg) { struct device *dev = &pdev->dev; - struct ohci_hcd *ohci = hcd_to_ohci(platform_get_drvdata(pdev)); + struct usb_hcd *hcd = platform_get_drvdata(pdev); + struct ohci_hcd *ohci = hcd_to_ohci(hcd); + bool do_wakeup = device_may_wakeup(dev); + int ret;
if (time_before(jiffies, ohci->next_statechange)) msleep(5); ohci->next_statechange = jiffies;
+ ret = ohci_suspend(hcd, do_wakeup); + sm501_unit_power(dev->parent, SM501_GATE_USB_HOST, 0); - return 0; + return ret; }
static int ohci_sm501_resume(struct platform_device *pdev)
Suspend scenario in case of ohci-spear glue was not properly handled as it was not suspending generic part of ohci controller.Calling explicitly the ohci_suspend() routine in spear_ohci_hcd_drv_suspend() will ensure proper handling of suspend scenario.
Signed-off-by: Manjunath Goudar manjunath.goudar@linaro.org Cc: Arnd Bergmann arnd@arndb.de Cc: Alan Stern stern@rowland.harvard.edu Cc: Greg KH greg@kroah.com Cc: linux-usb@vger.kernel.org --- drivers/usb/host/ohci-spear.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/host/ohci-spear.c b/drivers/usb/host/ohci-spear.c index 31ff3fc..5a843f0 100644 --- a/drivers/usb/host/ohci-spear.c +++ b/drivers/usb/host/ohci-spear.c @@ -130,20 +130,24 @@ static int spear_ohci_hcd_drv_remove(struct platform_device *pdev) }
#if defined(CONFIG_PM) -static int spear_ohci_hcd_drv_suspend(struct platform_device *dev, +static int spear_ohci_hcd_drv_suspend(struct platform_device *pdev, pm_message_t message) { - struct usb_hcd *hcd = platform_get_drvdata(dev); + struct usb_hcd *hcd = platform_get_drvdata(pdev); struct ohci_hcd *ohci = hcd_to_ohci(hcd); struct spear_ohci *sohci_p = to_spear_ohci(hcd); + bool do_wakeup = device_may_wakeup(&pdev->dev); + int ret;
if (time_before(jiffies, ohci->next_statechange)) msleep(5); ohci->next_statechange = jiffies;
+ ret = ohci_suspend(hcd, do_wakeup); + clk_disable_unprepare(sohci_p->clk);
- return 0; + return ret; }
static int spear_ohci_hcd_drv_resume(struct platform_device *dev)
Hello.
On 12-06-2013 19:28, Manjunath Goudar wrote:
Suspend scenario in case of ohci-da8xx glue was not properly handled as it was not suspending generic part of ohci controller.Calling explicitly the ohci_suspend() routine in ohci_da8xx_suspend() will ensure proper handling of suspend scenario.
Signed-off-by: Manjunath Goudar manjunath.goudar@linaro.org Cc: Arnd Bergmann arnd@arndb.de Cc: Alan Stern stern@rowland.harvard.edu Cc: Greg KH greg@kroah.com Cc: linux-usb@vger.kernel.org
drivers/usb/host/ohci-da8xx.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/host/ohci-da8xx.c b/drivers/usb/host/ohci-da8xx.c index 6aaa9c9..3b1d9bd 100644 --- a/drivers/usb/host/ohci-da8xx.c +++ b/drivers/usb/host/ohci-da8xx.c @@ -406,19 +406,24 @@ static int ohci_hcd_da8xx_drv_remove(struct platform_device *dev) }
#ifdef CONFIG_PM -static int ohci_da8xx_suspend(struct platform_device *dev, pm_message_t message) +static int ohci_da8xx_suspend(struct platform_device *pdev,
{pm_message_t message)
- struct usb_hcd *hcd = platform_get_drvdata(dev);
- struct usb_hcd *hcd = platform_get_drvdata(pdev); struct ohci_hcd *ohci = hcd_to_ohci(hcd);
- bool do_wakeup = device_may_wakeup(&pdev->dev);
Could you align = with other intializers above?
- int ret;
WBR, Sergei
Hello.
On 12-06-2013 19:28, Manjunath Goudar wrote:
Suspend scenario in case of ohci-s3c2410 glue was not properly handled as it was not suspending generic part of ohci controller.Calling explicitly the ohci_suspend() routine in ohci_hcd_s3c2410_drv_suspend() will ensure proper handling of suspend scenario.
Signed-off-by: Manjunath Goudar manjunath.goudar@linaro.org Cc: Arnd Bergmann arnd@arndb.de Cc: Alan Stern stern@rowland.harvard.edu Cc: Greg KH greg@kroah.com Cc: linux-usb@vger.kernel.org
drivers/usb/host/ohci-s3c2410.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/drivers/usb/host/ohci-s3c2410.c b/drivers/usb/host/ohci-s3c2410.c index 8018bb1..2ffa693 100644 --- a/drivers/usb/host/ohci-s3c2410.c +++ b/drivers/usb/host/ohci-s3c2410.c @@ -430,6 +430,7 @@ static int ohci_hcd_s3c2410_drv_suspend(struct device *dev) struct platform_device *pdev = to_platform_device(dev); unsigned long flags; int rc = 0;
bool do_wakeup = device_may_wakeup(dev);
/*
- Root hub was already suspended. Disable irq emission and
@@ -445,6 +446,8 @@ static int ohci_hcd_s3c2410_drv_suspend(struct device *dev)
clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
- rc = ohci_suspend(hcd, do_wakeup);
Why not call ohci_suspend with device_may_wakeup(&pdev->dev) result directly, saving on a local variable only used once? Same comment about the following patches...
WBR, Sergei
On Wed, 12 Jun 2013, Manjunath Goudar wrote:
Suspend scenario in case of ohci-at91 glue was not properly handled as it was not suspending generic part of ohci controller. Calling explicitly the ohci_suspend()routine in ohci_hcd_at91_drv_suspend() will ensure proper handling of suspend scenario.
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index fb2f127..28400a7 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c @@ -619,8 +619,12 @@ ohci_hcd_at91_drv_suspend(struct platform_device *pdev, pm_message_t mesg) { struct usb_hcd *hcd = platform_get_drvdata(pdev); struct ohci_hcd *ohci = hcd_to_ohci(hcd);
- bool do_wakeup = device_may_wakeup(&pdev->dev);
- int ret;
- if (device_may_wakeup(&pdev->dev))
- ret = ohci_suspend(hcd, do_wakeup);
- if (do_wakeup) enable_irq_wake(hcd->irq);
/* @@ -637,7 +641,7 @@ ohci_hcd_at91_drv_suspend(struct platform_device *pdev, pm_message_t mesg) at91_stop_clock(); }
- return 0;
- return ret;
If ohci_suspend() fails, we should return right away. Don't execute the enable_irq_wake() and all the other stuff.
Alan Stern
On 12 June 2013 21:24, Sergei Shtylyov sergei.shtylyov@cogentembedded.comwrote:
Hello.
On 12-06-2013 19:28, Manjunath Goudar wrote:
Suspend scenario in case of ohci-da8xx glue was not
properly handled as it was not suspending generic part of ohci controller.Calling explicitly the ohci_suspend() routine in ohci_da8xx_suspend() will ensure proper handling of suspend scenario.
Signed-off-by: Manjunath Goudar manjunath.goudar@linaro.org
Cc: Arnd Bergmann arnd@arndb.de Cc: Alan Stern stern@rowland.harvard.edu Cc: Greg KH greg@kroah.com Cc: linux-usb@vger.kernel.org
drivers/usb/host/ohci-da8xx.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/host/ohci-da8xx.**c
b/drivers/usb/host/ohci-da8xx.**c index 6aaa9c9..3b1d9bd 100644 --- a/drivers/usb/host/ohci-da8xx.**c +++ b/drivers/usb/host/ohci-da8xx.**c @@ -406,19 +406,24 @@ static int ohci_hcd_da8xx_drv_remove(**struct platform_device *dev) }
#ifdef CONFIG_PM -static int ohci_da8xx_suspend(struct platform_device *dev, pm_message_t message) +static int ohci_da8xx_suspend(struct platform_device *pdev,
{pm_message_t message)
struct usb_hcd *hcd = platform_get_drvdata(dev);
struct usb_hcd *hcd = platform_get_drvdata(pdev); struct ohci_hcd *ohci = hcd_to_ohci(hcd);
bool do_wakeup = device_may_wakeup(&pdev->dev);
Could you align = with other intializers above?
int ret;
I cross checked your comments in my series,it is not having any alignment problem,I dont know how it is showing align problem here.
WBR, Sergei
On Wed, 12 Jun 2013, Alan Stern wrote:
On Wed, 12 Jun 2013, Manjunath Goudar wrote:
Suspend scenario in case of ohci-at91 glue was not properly handled as it was not suspending generic part of ohci controller. Calling explicitly the ohci_suspend()routine in ohci_hcd_at91_drv_suspend() will ensure proper handling of suspend scenario.
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index fb2f127..28400a7 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c @@ -619,8 +619,12 @@ ohci_hcd_at91_drv_suspend(struct platform_device *pdev, pm_message_t mesg) { struct usb_hcd *hcd = platform_get_drvdata(pdev); struct ohci_hcd *ohci = hcd_to_ohci(hcd);
- bool do_wakeup = device_may_wakeup(&pdev->dev);
- int ret;
- if (device_may_wakeup(&pdev->dev))
- ret = ohci_suspend(hcd, do_wakeup);
- if (do_wakeup) enable_irq_wake(hcd->irq);
/* @@ -637,7 +641,7 @@ ohci_hcd_at91_drv_suspend(struct platform_device *pdev, pm_message_t mesg) at91_stop_clock(); }
- return 0;
- return ret;
If ohci_suspend() fails, we should return right away. Don't execute the enable_irq_wake() and all the other stuff.
Actually, the situation is more complicated. In order to handle races with remote wakeup, the logic we need is more like this:
Index: usb-3.10/drivers/usb/host/ohci-at91.c =================================================================== --- usb-3.10.orig/drivers/usb/host/ohci-at91.c +++ usb-3.10/drivers/usb/host/ohci-at91.c @@ -674,8 +674,18 @@ ohci_hcd_at91_drv_suspend(struct platfor { struct usb_hcd *hcd = platform_get_drvdata(pdev); struct ohci_hcd *ohci = hcd_to_ohci(hcd); + bool do_wakeup = device_may_wakeup(&pdev->dev); + int ret;
- if (device_may_wakeup(&pdev->dev)) + ret = ohci_suspend(hcd, do_wakeup); + if (ret == 0 && do_wakeup && HCD_WAKEUP_PENDING(hcd)) { + ohci_resume(hcd, false); + ret = -EBUSY; + } + if (ret) + return ret; + + if (do_wakeup) enable_irq_wake(hcd->irq);
/* @@ -692,7 +702,7 @@ ohci_hcd_at91_drv_suspend(struct platfor at91_stop_clock(); }
- return 0; + return ret; }
static int ohci_hcd_at91_drv_resume(struct platform_device *pdev)
The same is true for all the other drivers.
Alan Stern
Suspend scenario in case of ohci bus glue was not properly handled as it was not suspending generic part of ohci controller. Calling explicitly the ohci_suspend()routine will ensure proper handling of suspend scenario.
V2: -Incase ohci_suspend() fails, return right away without executing further.
Manjunath Goudar (10): USB: OHCI: Properly handle ohci-at91 suspend USB: OHCI: Properly handle ohci-s3c2410 suspend USB: OHCI: Properly handle ohci-da8xx suspend USB: OHCI: Properly handle ohci-ep93xx suspend USB: OHCI: Properly handle ohci-exynos suspend USB: OHCI: Properly handle ohci-omap suspend USB: OHCI: Properly handle ohci-platform suspend USB: OHCI: Properly handle ohci-pxa27x suspend USB: OHCI: Properly handle ohci-sm501 suspend USB: OHCI: Properly handle ohci-spear suspend
drivers/usb/host/ohci-at91.c | 14 ++++++++++++-- drivers/usb/host/ohci-da8xx.c | 19 +++++++++++++++---- drivers/usb/host/ohci-ep93xx.c | 12 +++++++++++- drivers/usb/host/ohci-exynos.c | 8 ++++++++ drivers/usb/host/ohci-omap.c | 17 ++++++++++++++--- drivers/usb/host/ohci-platform.c | 13 ++++++++++++- drivers/usb/host/ohci-pxa27x.c | 12 +++++++++++- drivers/usb/host/ohci-s3c2410.c | 8 ++++++++ drivers/usb/host/ohci-sm501.c | 15 +++++++++++++-- drivers/usb/host/ohci-spear.c | 16 +++++++++++++--- 10 files changed, 117 insertions(+), 17 deletions(-)
Suspend scenario in case of ohci-at91 glue was not properly handled as it was not suspending generic part of ohci controller. Calling explicitly the ohci_suspend() routine in ohci_hcd_at91_drv_suspend() will ensure proper handling of suspend scenario.
V2: -Incase ohci_suspend() fails, return right away without executing further.
Signed-off-by: Manjunath Goudar manjunath.goudar@linaro.org Cc: Arnd Bergmann arnd@arndb.de Cc: Alan Stern stern@rowland.harvard.edu Cc: Greg KH greg@kroah.com Cc: linux-usb@vger.kernel.org --- drivers/usb/host/ohci-at91.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index fb2f127..6620e3a 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c @@ -619,8 +619,18 @@ ohci_hcd_at91_drv_suspend(struct platform_device *pdev, pm_message_t mesg) { struct usb_hcd *hcd = platform_get_drvdata(pdev); struct ohci_hcd *ohci = hcd_to_ohci(hcd); + bool do_wakeup = device_may_wakeup(&pdev->dev); + int ret;
- if (device_may_wakeup(&pdev->dev)) + ret = ohci_suspend(hcd, do_wakeup); + if (ret == 0 && do_wakeup && HCD_WAKEUP_PENDING(hcd)) { + ohci_resume(hcd, false); + ret = -EBUSY; + } + if (ret) + return ret; + + if (do_wakeup) enable_irq_wake(hcd->irq);
/* @@ -637,7 +647,7 @@ ohci_hcd_at91_drv_suspend(struct platform_device *pdev, pm_message_t mesg) at91_stop_clock(); }
- return 0; + return ret; }
static int ohci_hcd_at91_drv_resume(struct platform_device *pdev)
Suspend scenario in case of ohci-s3c2410 glue was not properly handled as it was not suspending generic part of ohci controller.Calling explicitly the ohci_suspend() routine in ohci_hcd_s3c2410_drv_suspend() will ensure proper handling of suspend scenario.
V2: -Incase ohci_suspend() fails, return right away without executing further.
Signed-off-by: Manjunath Goudar manjunath.goudar@linaro.org Cc: Arnd Bergmann arnd@arndb.de Cc: Alan Stern stern@rowland.harvard.edu Cc: Greg KH greg@kroah.com Cc: linux-usb@vger.kernel.org --- drivers/usb/host/ohci-s3c2410.c | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/drivers/usb/host/ohci-s3c2410.c b/drivers/usb/host/ohci-s3c2410.c index 8018bb1..01430f2 100644 --- a/drivers/usb/host/ohci-s3c2410.c +++ b/drivers/usb/host/ohci-s3c2410.c @@ -430,7 +430,15 @@ static int ohci_hcd_s3c2410_drv_suspend(struct device *dev) struct platform_device *pdev = to_platform_device(dev); unsigned long flags; int rc = 0; + bool do_wakeup = device_may_wakeup(dev);
+ rc = ohci_suspend(hcd, do_wakeup); + if (rc == 0 && do_wakeup && HCD_WAKEUP_PENDING(hcd)) { + ohci_resume(hcd, false); + rc = -EBUSY; + } + if (rc) + return rc; /* * Root hub was already suspended. Disable irq emission and * mark HW unaccessible, bail out if RH has been resumed. Use
Suspend scenario in case of ohci-da8xx glue was not properly handled as it was not suspending generic part of ohci controller.Calling explicitly the ohci_suspend() routine in ohci_da8xx_suspend() will ensure proper handling of suspend scenario.
V2: -Incase ohci_suspend() fails, return right away without executing further.
Signed-off-by: Manjunath Goudar manjunath.goudar@linaro.org Cc: Arnd Bergmann arnd@arndb.de Cc: Alan Stern stern@rowland.harvard.edu Cc: Greg KH greg@kroah.com Cc: linux-usb@vger.kernel.org --- drivers/usb/host/ohci-da8xx.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/host/ohci-da8xx.c b/drivers/usb/host/ohci-da8xx.c index 6aaa9c9..8d4914d 100644 --- a/drivers/usb/host/ohci-da8xx.c +++ b/drivers/usb/host/ohci-da8xx.c @@ -406,10 +406,21 @@ static int ohci_hcd_da8xx_drv_remove(struct platform_device *dev) }
#ifdef CONFIG_PM -static int ohci_da8xx_suspend(struct platform_device *dev, pm_message_t message) +static int ohci_da8xx_suspend(struct platform_device *pdev, + pm_message_t message) { - struct usb_hcd *hcd = platform_get_drvdata(dev); + struct usb_hcd *hcd = platform_get_drvdata(pdev); struct ohci_hcd *ohci = hcd_to_ohci(hcd); + bool do_wakeup = device_may_wakeup(&pdev->dev); + int ret; + + ret = ohci_suspend(hcd, do_wakeup); + if (ret == 0 && do_wakeup && HCD_WAKEUP_PENDING(hcd)) { + ohci_resume(hcd, false); + ret = -EBUSY; + } + if (ret) + return ret;
if (time_before(jiffies, ohci->next_statechange)) msleep(5); @@ -417,8 +428,8 @@ static int ohci_da8xx_suspend(struct platform_device *dev, pm_message_t message)
ohci_da8xx_clock(0); hcd->state = HC_STATE_SUSPENDED; - dev->dev.power.power_state = PMSG_SUSPEND; - return 0; + pdev->dev.power.power_state = PMSG_SUSPEND; + return ret; }
static int ohci_da8xx_resume(struct platform_device *dev)
Suspend scenario in case of ohci-ep93xx glue was not properly handled as it was not suspending generic part of ohci controller.Calling explicitly the ohci_suspend() routine in ohci_hcd_ep93xx_drv_suspend() will ensure proper handling of suspend scenario.
V2: -Incase ohci_suspend() fails, return right away without executing further.
Signed-off-by: Manjunath Goudar manjunath.goudar@linaro.org Cc: Arnd Bergmann arnd@arndb.de Cc: Alan Stern stern@rowland.harvard.edu Cc: Greg KH greg@kroah.com Cc: linux-usb@vger.kernel.org --- drivers/usb/host/ohci-ep93xx.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/host/ohci-ep93xx.c b/drivers/usb/host/ohci-ep93xx.c index 8704e9f..b36b74e 100644 --- a/drivers/usb/host/ohci-ep93xx.c +++ b/drivers/usb/host/ohci-ep93xx.c @@ -174,13 +174,23 @@ static int ohci_hcd_ep93xx_drv_suspend(struct platform_device *pdev, pm_message_ { struct usb_hcd *hcd = platform_get_drvdata(pdev); struct ohci_hcd *ohci = hcd_to_ohci(hcd); + bool do_wakeup = device_may_wakeup(&pdev->dev); + int ret; + + ret = ohci_suspend(hcd, do_wakeup); + if (ret == 0 && do_wakeup && HCD_WAKEUP_PENDING(hcd)) { + ohci_resume(hcd, false); + ret = -EBUSY; + } + if (ret) + return ret;
if (time_before(jiffies, ohci->next_statechange)) msleep(5); ohci->next_statechange = jiffies;
ep93xx_stop_hc(&pdev->dev); - return 0; + return ret; }
static int ohci_hcd_ep93xx_drv_resume(struct platform_device *pdev)
Suspend scenario in case of ohci-exynos glue was not properly handled as it was not suspending generic part of ohci controller.Calling explicitly the ohci_suspend() routine in exynos_ohci_suspend() will ensure proper handling of suspend scenario.
V2: -Incase ohci_suspend() fails, return right away without executing further.
Signed-off-by: Manjunath Goudar manjunath.goudar@linaro.org Cc: Arnd Bergmann arnd@arndb.de Cc: Alan Stern stern@rowland.harvard.edu Cc: Greg KH greg@kroah.com Cc: linux-usb@vger.kernel.org --- drivers/usb/host/ohci-exynos.c | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c index 6ff830c..8fecb6a 100644 --- a/drivers/usb/host/ohci-exynos.c +++ b/drivers/usb/host/ohci-exynos.c @@ -203,9 +203,17 @@ static int exynos_ohci_suspend(struct device *dev) struct exynos_ohci_hcd *exynos_ohci = to_exynos_ohci(hcd); struct ohci_hcd *ohci = hcd_to_ohci(hcd); struct platform_device *pdev = to_platform_device(dev); + bool do_wakeup = device_may_wakeup(dev); unsigned long flags; int rc = 0;
+ rc = ohci_suspend(hcd, do_wakeup); + if (rc == 0 && do_wakeup && HCD_WAKEUP_PENDING(hcd)) { + ohci_resume(hcd, false); + rc = -EBUSY; + } + if (rc) + return rc; /* * Root hub was already suspended. Disable irq emission and * mark HW unaccessible, bail out if RH has been resumed. Use
Suspend scenario in case of ohci-omap glue was not properly handled as it was not suspending generic part of ohci controller.Calling explicitly the ohci_suspend() routine in ohci_omap_suspend() will ensure proper handling of suspend scenario.
V2: -Incase ohci_suspend() fails, return right away without executing further.
Signed-off-by: Manjunath Goudar manjunath.goudar@linaro.org Cc: Arnd Bergmann arnd@arndb.de Cc: Alan Stern stern@rowland.harvard.edu Cc: Greg KH greg@kroah.com Cc: linux-usb@vger.kernel.org --- drivers/usb/host/ohci-omap.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c index b900dba..9144315 100644 --- a/drivers/usb/host/ohci-omap.c +++ b/drivers/usb/host/ohci-omap.c @@ -423,16 +423,27 @@ static int ohci_hcd_omap_drv_remove(struct platform_device *dev)
#ifdef CONFIG_PM
-static int ohci_omap_suspend(struct platform_device *dev, pm_message_t message) +static int ohci_omap_suspend(struct platform_device *pdev, pm_message_t message) { - struct ohci_hcd *ohci = hcd_to_ohci(platform_get_drvdata(dev)); + struct usb_hcd *hcd = platform_get_drvdata(pdev); + struct ohci_hcd *ohci = hcd_to_ohci(hcd); + bool do_wakeup = device_may_wakeup(&pdev->dev); + int ret; + + ret = ohci_suspend(hcd, do_wakeup); + if (ret == 0 && do_wakeup && HCD_WAKEUP_PENDING(hcd)) { + ohci_resume(hcd, false); + ret = -EBUSY; + } + if (ret) + return ret;
if (time_before(jiffies, ohci->next_statechange)) msleep(5); ohci->next_statechange = jiffies;
omap_ohci_clock_power(0); - return 0; + return ret; }
static int ohci_omap_resume(struct platform_device *dev)
Suspend scenario in case of ohci-platform glue was not properly handled as it was not suspending generic part of ohci controller.Calling explicitly the ohci_suspend() routine in ohci_platform_suspend() will ensure proper handling of suspend scenario.
V2: -Incase ohci_suspend() fails, return right away without executing further.
Signed-off-by: Manjunath Goudar manjunath.goudar@linaro.org Cc: Arnd Bergmann arnd@arndb.de Cc: Alan Stern stern@rowland.harvard.edu Cc: Greg KH greg@kroah.com Cc: linux-usb@vger.kernel.org --- drivers/usb/host/ohci-platform.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c index bc30475..f91201b 100644 --- a/drivers/usb/host/ohci-platform.c +++ b/drivers/usb/host/ohci-platform.c @@ -139,14 +139,25 @@ static int ohci_platform_remove(struct platform_device *dev)
static int ohci_platform_suspend(struct device *dev) { + struct usb_hcd *hcd = dev_get_drvdata(dev); struct usb_ohci_pdata *pdata = dev->platform_data; struct platform_device *pdev = container_of(dev, struct platform_device, dev); + bool do_wakeup = device_may_wakeup(dev); + int ret; + + ret = ohci_suspend(hcd, do_wakeup); + if (ret == 0 && do_wakeup && HCD_WAKEUP_PENDING(hcd)) { + ohci_resume(hcd, false); + ret = -EBUSY; + } + if (ret) + return ret;
if (pdata->power_suspend) pdata->power_suspend(pdev);
- return 0; + return ret; }
static int ohci_platform_resume(struct device *dev)
Suspend scenario in case of ohci-pxa27x glue was not properly handled as it was not suspending generic part of ohci controller.Calling explicitly the ohci_suspend() routine in ohci_hcd_pxa27x_drv_suspend() will ensure proper handling of suspend scenario.
V2: -Incase ohci_suspend() fails, return right away without executing further.
Signed-off-by: Manjunath Goudar manjunath.goudar@linaro.org Cc: Arnd Bergmann arnd@arndb.de Cc: Alan Stern stern@rowland.harvard.edu Cc: Greg KH greg@kroah.com Cc: linux-usb@vger.kernel.org --- drivers/usb/host/ohci-pxa27x.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c index 3a9c01d..d441a87 100644 --- a/drivers/usb/host/ohci-pxa27x.c +++ b/drivers/usb/host/ohci-pxa27x.c @@ -564,13 +564,23 @@ static int ohci_hcd_pxa27x_drv_suspend(struct device *dev) { struct usb_hcd *hcd = dev_get_drvdata(dev); struct pxa27x_ohci *ohci = to_pxa27x_ohci(hcd); + bool do_wakeup = device_may_wakeup(dev); + int ret; + + ret = ohci_suspend(hcd, do_wakeup); + if (ret == 0 && do_wakeup && HCD_WAKEUP_PENDING(hcd)) { + ohci_resume(hcd, false); + ret = -EBUSY; + } + if (ret) + return ret;
if (time_before(jiffies, ohci->ohci.next_statechange)) msleep(5); ohci->ohci.next_statechange = jiffies;
pxa27x_stop_hc(ohci, dev); - return 0; + return ret; }
static int ohci_hcd_pxa27x_drv_resume(struct device *dev)
Suspend scenario in case of ohci-sm501 glue was not properly handled as it was not suspending generic part of ohci controller.Calling explicitly the ohci_suspend() routine in ohci_sm501_suspend() will ensure proper handling of suspend scenario.
V2: -Incase ohci_suspend() fails, return right away without executing further.
Signed-off-by: Manjunath Goudar manjunath.goudar@linaro.org Cc: Arnd Bergmann arnd@arndb.de Cc: Alan Stern stern@rowland.harvard.edu Cc: Greg KH greg@kroah.com Cc: linux-usb@vger.kernel.org --- drivers/usb/host/ohci-sm501.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/host/ohci-sm501.c b/drivers/usb/host/ohci-sm501.c index d479d5d..81ebbce 100644 --- a/drivers/usb/host/ohci-sm501.c +++ b/drivers/usb/host/ohci-sm501.c @@ -216,14 +216,25 @@ static int ohci_hcd_sm501_drv_remove(struct platform_device *pdev) static int ohci_sm501_suspend(struct platform_device *pdev, pm_message_t msg) { struct device *dev = &pdev->dev; - struct ohci_hcd *ohci = hcd_to_ohci(platform_get_drvdata(pdev)); + struct usb_hcd *hcd = platform_get_drvdata(pdev); + struct ohci_hcd *ohci = hcd_to_ohci(hcd); + bool do_wakeup = device_may_wakeup(dev); + int ret; + + ret = ohci_suspend(hcd, do_wakeup); + if (ret == 0 && do_wakeup && HCD_WAKEUP_PENDING(hcd)) { + ohci_resume(hcd, false); + ret = -EBUSY; + } + if (ret) + return ret;
if (time_before(jiffies, ohci->next_statechange)) msleep(5); ohci->next_statechange = jiffies;
sm501_unit_power(dev->parent, SM501_GATE_USB_HOST, 0); - return 0; + return ret; }
static int ohci_sm501_resume(struct platform_device *pdev)
Suspend scenario in case of ohci-spear glue was not properly handled as it was not suspending generic part of ohci controller.Calling explicitly the ohci_suspend() routine in spear_ohci_hcd_drv_suspend() will ensure proper handling of suspend scenario.
V2: -Incase ohci_suspend() fails, return right away without executing further.
Signed-off-by: Manjunath Goudar manjunath.goudar@linaro.org Cc: Arnd Bergmann arnd@arndb.de Cc: Alan Stern stern@rowland.harvard.edu Cc: Greg KH greg@kroah.com Cc: linux-usb@vger.kernel.org --- drivers/usb/host/ohci-spear.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/host/ohci-spear.c b/drivers/usb/host/ohci-spear.c index 31ff3fc..2ff867b 100644 --- a/drivers/usb/host/ohci-spear.c +++ b/drivers/usb/host/ohci-spear.c @@ -130,12 +130,22 @@ static int spear_ohci_hcd_drv_remove(struct platform_device *pdev) }
#if defined(CONFIG_PM) -static int spear_ohci_hcd_drv_suspend(struct platform_device *dev, +static int spear_ohci_hcd_drv_suspend(struct platform_device *pdev, pm_message_t message) { - struct usb_hcd *hcd = platform_get_drvdata(dev); + struct usb_hcd *hcd = platform_get_drvdata(pdev); struct ohci_hcd *ohci = hcd_to_ohci(hcd); struct spear_ohci *sohci_p = to_spear_ohci(hcd); + bool do_wakeup = device_may_wakeup(&pdev->dev); + int ret; + + ret = ohci_suspend(hcd, do_wakeup); + if (ret == 0 && do_wakeup && HCD_WAKEUP_PENDING(hcd)) { + ohci_resume(hcd, false); + ret = -EBUSY; + } + if (ret) + return ret;
if (time_before(jiffies, ohci->next_statechange)) msleep(5); @@ -143,7 +153,7 @@ static int spear_ohci_hcd_drv_suspend(struct platform_device *dev,
clk_disable_unprepare(sohci_p->clk);
- return 0; + return ret; }
static int spear_ohci_hcd_drv_resume(struct platform_device *dev)
Suspend scenario in case of ohci bus glue was not properly handled as it was not suspending generic part of ohci controller. Calling explicitly the ohci_suspend()routine will ensure proper handling of suspend scenario.
V2: -Incase ohci_suspend() fails, return right away without executing further.
Manjunath Goudar (10): USB: OHCI: Properly handle ohci-at91 suspend USB: OHCI: Properly handle ohci-s3c2410 suspend USB: OHCI: Properly handle ohci-da8xx suspend USB: OHCI: Properly handle ohci-ep93xx suspend USB: OHCI: Properly handle ohci-exynos suspend USB: OHCI: Properly handle ohci-omap suspend USB: OHCI: Properly handle ohci-platform suspend USB: OHCI: Properly handle ohci-pxa27x suspend USB: OHCI: Properly handle ohci-sm501 suspend USB: OHCI: Properly handle ohci-spear suspend
drivers/usb/host/ohci-at91.c | 14 ++++++++++++-- drivers/usb/host/ohci-da8xx.c | 19 +++++++++++++++---- drivers/usb/host/ohci-ep93xx.c | 12 +++++++++++- drivers/usb/host/ohci-exynos.c | 8 ++++++++ drivers/usb/host/ohci-omap.c | 17 ++++++++++++++--- drivers/usb/host/ohci-platform.c | 13 ++++++++++++- drivers/usb/host/ohci-pxa27x.c | 12 +++++++++++- drivers/usb/host/ohci-s3c2410.c | 8 ++++++++ drivers/usb/host/ohci-sm501.c | 15 +++++++++++++-- drivers/usb/host/ohci-spear.c | 16 +++++++++++++--- 10 files changed, 117 insertions(+), 17 deletions(-)
Suspend scenario in case of ohci-at91 glue was not properly handled as it was not suspending generic part of ohci controller. Calling explicitly the ohci_suspend() routine in ohci_hcd_at91_drv_suspend() will ensure proper handling of suspend scenario.
V2: -Incase ohci_suspend() fails, return right away without executing further.
Signed-off-by: Manjunath Goudar manjunath.goudar@linaro.org Cc: Arnd Bergmann arnd@arndb.de Cc: Alan Stern stern@rowland.harvard.edu Cc: Greg KH greg@kroah.com Cc: linux-usb@vger.kernel.org --- drivers/usb/host/ohci-at91.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index fb2f127..6620e3a 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c @@ -619,8 +619,18 @@ ohci_hcd_at91_drv_suspend(struct platform_device *pdev, pm_message_t mesg) { struct usb_hcd *hcd = platform_get_drvdata(pdev); struct ohci_hcd *ohci = hcd_to_ohci(hcd); + bool do_wakeup = device_may_wakeup(&pdev->dev); + int ret;
- if (device_may_wakeup(&pdev->dev)) + ret = ohci_suspend(hcd, do_wakeup); + if (ret == 0 && do_wakeup && HCD_WAKEUP_PENDING(hcd)) { + ohci_resume(hcd, false); + ret = -EBUSY; + } + if (ret) + return ret; + + if (do_wakeup) enable_irq_wake(hcd->irq);
/* @@ -637,7 +647,7 @@ ohci_hcd_at91_drv_suspend(struct platform_device *pdev, pm_message_t mesg) at91_stop_clock(); }
- return 0; + return ret; }
static int ohci_hcd_at91_drv_resume(struct platform_device *pdev)
Suspend scenario in case of ohci-s3c2410 glue was not properly handled as it was not suspending generic part of ohci controller.Calling explicitly the ohci_suspend() routine in ohci_hcd_s3c2410_drv_suspend() will ensure proper handling of suspend scenario.
V2: -Incase ohci_suspend() fails, return right away without executing further.
Signed-off-by: Manjunath Goudar manjunath.goudar@linaro.org Cc: Arnd Bergmann arnd@arndb.de Cc: Alan Stern stern@rowland.harvard.edu Cc: Greg KH greg@kroah.com Cc: linux-usb@vger.kernel.org --- drivers/usb/host/ohci-s3c2410.c | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/drivers/usb/host/ohci-s3c2410.c b/drivers/usb/host/ohci-s3c2410.c index 8018bb1..01430f2 100644 --- a/drivers/usb/host/ohci-s3c2410.c +++ b/drivers/usb/host/ohci-s3c2410.c @@ -430,7 +430,15 @@ static int ohci_hcd_s3c2410_drv_suspend(struct device *dev) struct platform_device *pdev = to_platform_device(dev); unsigned long flags; int rc = 0; + bool do_wakeup = device_may_wakeup(dev);
+ rc = ohci_suspend(hcd, do_wakeup); + if (rc == 0 && do_wakeup && HCD_WAKEUP_PENDING(hcd)) { + ohci_resume(hcd, false); + rc = -EBUSY; + } + if (rc) + return rc; /* * Root hub was already suspended. Disable irq emission and * mark HW unaccessible, bail out if RH has been resumed. Use
Suspend scenario in case of ohci-da8xx glue was not properly handled as it was not suspending generic part of ohci controller.Calling explicitly the ohci_suspend() routine in ohci_da8xx_suspend() will ensure proper handling of suspend scenario.
V2: -Incase ohci_suspend() fails, return right away without executing further.
Signed-off-by: Manjunath Goudar manjunath.goudar@linaro.org Cc: Arnd Bergmann arnd@arndb.de Cc: Alan Stern stern@rowland.harvard.edu Cc: Greg KH greg@kroah.com Cc: linux-usb@vger.kernel.org --- drivers/usb/host/ohci-da8xx.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/host/ohci-da8xx.c b/drivers/usb/host/ohci-da8xx.c index 6aaa9c9..8d4914d 100644 --- a/drivers/usb/host/ohci-da8xx.c +++ b/drivers/usb/host/ohci-da8xx.c @@ -406,10 +406,21 @@ static int ohci_hcd_da8xx_drv_remove(struct platform_device *dev) }
#ifdef CONFIG_PM -static int ohci_da8xx_suspend(struct platform_device *dev, pm_message_t message) +static int ohci_da8xx_suspend(struct platform_device *pdev, + pm_message_t message) { - struct usb_hcd *hcd = platform_get_drvdata(dev); + struct usb_hcd *hcd = platform_get_drvdata(pdev); struct ohci_hcd *ohci = hcd_to_ohci(hcd); + bool do_wakeup = device_may_wakeup(&pdev->dev); + int ret; + + ret = ohci_suspend(hcd, do_wakeup); + if (ret == 0 && do_wakeup && HCD_WAKEUP_PENDING(hcd)) { + ohci_resume(hcd, false); + ret = -EBUSY; + } + if (ret) + return ret;
if (time_before(jiffies, ohci->next_statechange)) msleep(5); @@ -417,8 +428,8 @@ static int ohci_da8xx_suspend(struct platform_device *dev, pm_message_t message)
ohci_da8xx_clock(0); hcd->state = HC_STATE_SUSPENDED; - dev->dev.power.power_state = PMSG_SUSPEND; - return 0; + pdev->dev.power.power_state = PMSG_SUSPEND; + return ret; }
static int ohci_da8xx_resume(struct platform_device *dev)
Suspend scenario in case of ohci-ep93xx glue was not properly handled as it was not suspending generic part of ohci controller.Calling explicitly the ohci_suspend() routine in ohci_hcd_ep93xx_drv_suspend() will ensure proper handling of suspend scenario.
V2: -Incase ohci_suspend() fails, return right away without executing further.
Signed-off-by: Manjunath Goudar manjunath.goudar@linaro.org Cc: Arnd Bergmann arnd@arndb.de Cc: Alan Stern stern@rowland.harvard.edu Cc: Greg KH greg@kroah.com Cc: linux-usb@vger.kernel.org --- drivers/usb/host/ohci-ep93xx.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/host/ohci-ep93xx.c b/drivers/usb/host/ohci-ep93xx.c index 8704e9f..b36b74e 100644 --- a/drivers/usb/host/ohci-ep93xx.c +++ b/drivers/usb/host/ohci-ep93xx.c @@ -174,13 +174,23 @@ static int ohci_hcd_ep93xx_drv_suspend(struct platform_device *pdev, pm_message_ { struct usb_hcd *hcd = platform_get_drvdata(pdev); struct ohci_hcd *ohci = hcd_to_ohci(hcd); + bool do_wakeup = device_may_wakeup(&pdev->dev); + int ret; + + ret = ohci_suspend(hcd, do_wakeup); + if (ret == 0 && do_wakeup && HCD_WAKEUP_PENDING(hcd)) { + ohci_resume(hcd, false); + ret = -EBUSY; + } + if (ret) + return ret;
if (time_before(jiffies, ohci->next_statechange)) msleep(5); ohci->next_statechange = jiffies;
ep93xx_stop_hc(&pdev->dev); - return 0; + return ret; }
static int ohci_hcd_ep93xx_drv_resume(struct platform_device *pdev)
Suspend scenario in case of ohci-exynos glue was not properly handled as it was not suspending generic part of ohci controller.Calling explicitly the ohci_suspend() routine in exynos_ohci_suspend() will ensure proper handling of suspend scenario.
V2: -Incase ohci_suspend() fails, return right away without executing further.
Signed-off-by: Manjunath Goudar manjunath.goudar@linaro.org Cc: Arnd Bergmann arnd@arndb.de Cc: Alan Stern stern@rowland.harvard.edu Cc: Greg KH greg@kroah.com Cc: linux-usb@vger.kernel.org --- drivers/usb/host/ohci-exynos.c | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c index 6ff830c..8fecb6a 100644 --- a/drivers/usb/host/ohci-exynos.c +++ b/drivers/usb/host/ohci-exynos.c @@ -203,9 +203,17 @@ static int exynos_ohci_suspend(struct device *dev) struct exynos_ohci_hcd *exynos_ohci = to_exynos_ohci(hcd); struct ohci_hcd *ohci = hcd_to_ohci(hcd); struct platform_device *pdev = to_platform_device(dev); + bool do_wakeup = device_may_wakeup(dev); unsigned long flags; int rc = 0;
+ rc = ohci_suspend(hcd, do_wakeup); + if (rc == 0 && do_wakeup && HCD_WAKEUP_PENDING(hcd)) { + ohci_resume(hcd, false); + rc = -EBUSY; + } + if (rc) + return rc; /* * Root hub was already suspended. Disable irq emission and * mark HW unaccessible, bail out if RH has been resumed. Use
Suspend scenario in case of ohci-omap glue was not properly handled as it was not suspending generic part of ohci controller.Calling explicitly the ohci_suspend() routine in ohci_omap_suspend() will ensure proper handling of suspend scenario.
V2: -Incase ohci_suspend() fails, return right away without executing further.
Signed-off-by: Manjunath Goudar manjunath.goudar@linaro.org Cc: Arnd Bergmann arnd@arndb.de Cc: Alan Stern stern@rowland.harvard.edu Cc: Greg KH greg@kroah.com Cc: linux-usb@vger.kernel.org --- drivers/usb/host/ohci-omap.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c index b900dba..9144315 100644 --- a/drivers/usb/host/ohci-omap.c +++ b/drivers/usb/host/ohci-omap.c @@ -423,16 +423,27 @@ static int ohci_hcd_omap_drv_remove(struct platform_device *dev)
#ifdef CONFIG_PM
-static int ohci_omap_suspend(struct platform_device *dev, pm_message_t message) +static int ohci_omap_suspend(struct platform_device *pdev, pm_message_t message) { - struct ohci_hcd *ohci = hcd_to_ohci(platform_get_drvdata(dev)); + struct usb_hcd *hcd = platform_get_drvdata(pdev); + struct ohci_hcd *ohci = hcd_to_ohci(hcd); + bool do_wakeup = device_may_wakeup(&pdev->dev); + int ret; + + ret = ohci_suspend(hcd, do_wakeup); + if (ret == 0 && do_wakeup && HCD_WAKEUP_PENDING(hcd)) { + ohci_resume(hcd, false); + ret = -EBUSY; + } + if (ret) + return ret;
if (time_before(jiffies, ohci->next_statechange)) msleep(5); ohci->next_statechange = jiffies;
omap_ohci_clock_power(0); - return 0; + return ret; }
static int ohci_omap_resume(struct platform_device *dev)
Suspend scenario in case of ohci-platform glue was not properly handled as it was not suspending generic part of ohci controller.Calling explicitly the ohci_suspend() routine in ohci_platform_suspend() will ensure proper handling of suspend scenario.
V2: -Incase ohci_suspend() fails, return right away without executing further.
Signed-off-by: Manjunath Goudar manjunath.goudar@linaro.org Cc: Arnd Bergmann arnd@arndb.de Cc: Alan Stern stern@rowland.harvard.edu Cc: Greg KH greg@kroah.com Cc: linux-usb@vger.kernel.org --- drivers/usb/host/ohci-platform.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c index bc30475..f91201b 100644 --- a/drivers/usb/host/ohci-platform.c +++ b/drivers/usb/host/ohci-platform.c @@ -139,14 +139,25 @@ static int ohci_platform_remove(struct platform_device *dev)
static int ohci_platform_suspend(struct device *dev) { + struct usb_hcd *hcd = dev_get_drvdata(dev); struct usb_ohci_pdata *pdata = dev->platform_data; struct platform_device *pdev = container_of(dev, struct platform_device, dev); + bool do_wakeup = device_may_wakeup(dev); + int ret; + + ret = ohci_suspend(hcd, do_wakeup); + if (ret == 0 && do_wakeup && HCD_WAKEUP_PENDING(hcd)) { + ohci_resume(hcd, false); + ret = -EBUSY; + } + if (ret) + return ret;
if (pdata->power_suspend) pdata->power_suspend(pdev);
- return 0; + return ret; }
static int ohci_platform_resume(struct device *dev)
Suspend scenario in case of ohci-pxa27x glue was not properly handled as it was not suspending generic part of ohci controller.Calling explicitly the ohci_suspend() routine in ohci_hcd_pxa27x_drv_suspend() will ensure proper handling of suspend scenario.
V2: -Incase ohci_suspend() fails, return right away without executing further.
Signed-off-by: Manjunath Goudar manjunath.goudar@linaro.org Cc: Arnd Bergmann arnd@arndb.de Cc: Alan Stern stern@rowland.harvard.edu Cc: Greg KH greg@kroah.com Cc: linux-usb@vger.kernel.org --- drivers/usb/host/ohci-pxa27x.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c index 3a9c01d..d441a87 100644 --- a/drivers/usb/host/ohci-pxa27x.c +++ b/drivers/usb/host/ohci-pxa27x.c @@ -564,13 +564,23 @@ static int ohci_hcd_pxa27x_drv_suspend(struct device *dev) { struct usb_hcd *hcd = dev_get_drvdata(dev); struct pxa27x_ohci *ohci = to_pxa27x_ohci(hcd); + bool do_wakeup = device_may_wakeup(dev); + int ret; + + ret = ohci_suspend(hcd, do_wakeup); + if (ret == 0 && do_wakeup && HCD_WAKEUP_PENDING(hcd)) { + ohci_resume(hcd, false); + ret = -EBUSY; + } + if (ret) + return ret;
if (time_before(jiffies, ohci->ohci.next_statechange)) msleep(5); ohci->ohci.next_statechange = jiffies;
pxa27x_stop_hc(ohci, dev); - return 0; + return ret; }
static int ohci_hcd_pxa27x_drv_resume(struct device *dev)
Suspend scenario in case of ohci-sm501 glue was not properly handled as it was not suspending generic part of ohci controller.Calling explicitly the ohci_suspend() routine in ohci_sm501_suspend() will ensure proper handling of suspend scenario.
V2: -Incase ohci_suspend() fails, return right away without executing further.
Signed-off-by: Manjunath Goudar manjunath.goudar@linaro.org Cc: Arnd Bergmann arnd@arndb.de Cc: Alan Stern stern@rowland.harvard.edu Cc: Greg KH greg@kroah.com Cc: linux-usb@vger.kernel.org --- drivers/usb/host/ohci-sm501.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/host/ohci-sm501.c b/drivers/usb/host/ohci-sm501.c index d479d5d..81ebbce 100644 --- a/drivers/usb/host/ohci-sm501.c +++ b/drivers/usb/host/ohci-sm501.c @@ -216,14 +216,25 @@ static int ohci_hcd_sm501_drv_remove(struct platform_device *pdev) static int ohci_sm501_suspend(struct platform_device *pdev, pm_message_t msg) { struct device *dev = &pdev->dev; - struct ohci_hcd *ohci = hcd_to_ohci(platform_get_drvdata(pdev)); + struct usb_hcd *hcd = platform_get_drvdata(pdev); + struct ohci_hcd *ohci = hcd_to_ohci(hcd); + bool do_wakeup = device_may_wakeup(dev); + int ret; + + ret = ohci_suspend(hcd, do_wakeup); + if (ret == 0 && do_wakeup && HCD_WAKEUP_PENDING(hcd)) { + ohci_resume(hcd, false); + ret = -EBUSY; + } + if (ret) + return ret;
if (time_before(jiffies, ohci->next_statechange)) msleep(5); ohci->next_statechange = jiffies;
sm501_unit_power(dev->parent, SM501_GATE_USB_HOST, 0); - return 0; + return ret; }
static int ohci_sm501_resume(struct platform_device *pdev)
Suspend scenario in case of ohci-spear glue was not properly handled as it was not suspending generic part of ohci controller.Calling explicitly the ohci_suspend() routine in spear_ohci_hcd_drv_suspend() will ensure proper handling of suspend scenario.
V2: -Incase ohci_suspend() fails, return right away without executing further.
Signed-off-by: Manjunath Goudar manjunath.goudar@linaro.org Cc: Arnd Bergmann arnd@arndb.de Cc: Alan Stern stern@rowland.harvard.edu Cc: Greg KH greg@kroah.com Cc: linux-usb@vger.kernel.org --- drivers/usb/host/ohci-spear.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/host/ohci-spear.c b/drivers/usb/host/ohci-spear.c index 31ff3fc..2ff867b 100644 --- a/drivers/usb/host/ohci-spear.c +++ b/drivers/usb/host/ohci-spear.c @@ -130,12 +130,22 @@ static int spear_ohci_hcd_drv_remove(struct platform_device *pdev) }
#if defined(CONFIG_PM) -static int spear_ohci_hcd_drv_suspend(struct platform_device *dev, +static int spear_ohci_hcd_drv_suspend(struct platform_device *pdev, pm_message_t message) { - struct usb_hcd *hcd = platform_get_drvdata(dev); + struct usb_hcd *hcd = platform_get_drvdata(pdev); struct ohci_hcd *ohci = hcd_to_ohci(hcd); struct spear_ohci *sohci_p = to_spear_ohci(hcd); + bool do_wakeup = device_may_wakeup(&pdev->dev); + int ret; + + ret = ohci_suspend(hcd, do_wakeup); + if (ret == 0 && do_wakeup && HCD_WAKEUP_PENDING(hcd)) { + ohci_resume(hcd, false); + ret = -EBUSY; + } + if (ret) + return ret;
if (time_before(jiffies, ohci->next_statechange)) msleep(5); @@ -143,7 +153,7 @@ static int spear_ohci_hcd_drv_suspend(struct platform_device *dev,
clk_disable_unprepare(sohci_p->clk);
- return 0; + return ret; }
static int spear_ohci_hcd_drv_resume(struct platform_device *dev)
On 13 June 2013 14:41, Manjunath Goudar manjunath.goudar@linaro.org wrote:
Suspend scenario in case of ohci-spear glue was not properly handled as it was not suspending generic part of ohci controller.Calling explicitly the ohci_suspend()
Add space after full stop.
routine in spear_ohci_hcd_drv_suspend() will ensure proper handling of suspend scenario.
V2: -Incase ohci_suspend() fails, return right away without executing further.
You added changelog at wrong place. This will get commited once somebody applies this patch.
Signed-off-by: Manjunath Goudar manjunath.goudar@linaro.org Cc: Arnd Bergmann arnd@arndb.de Cc: Alan Stern stern@rowland.harvard.edu Cc: Greg KH greg@kroah.com Cc: linux-usb@vger.kernel.org
Add it here.
drivers/usb/host/ohci-spear.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/host/ohci-spear.c b/drivers/usb/host/ohci-spear.c index 31ff3fc..2ff867b 100644 --- a/drivers/usb/host/ohci-spear.c +++ b/drivers/usb/host/ohci-spear.c @@ -130,12 +130,22 @@ static int spear_ohci_hcd_drv_remove(struct platform_device *pdev) }
#if defined(CONFIG_PM) -static int spear_ohci_hcd_drv_suspend(struct platform_device *dev, +static int spear_ohci_hcd_drv_suspend(struct platform_device *pdev, pm_message_t message) {
struct usb_hcd *hcd = platform_get_drvdata(dev);
struct usb_hcd *hcd = platform_get_drvdata(pdev); struct ohci_hcd *ohci = hcd_to_ohci(hcd); struct spear_ohci *sohci_p = to_spear_ohci(hcd);
bool do_wakeup = device_may_wakeup(&pdev->dev);
int ret;
ret = ohci_suspend(hcd, do_wakeup);
if (ret == 0 && do_wakeup && HCD_WAKEUP_PENDING(hcd)) {
maybe s/ret == 0/!ret
I thought ret == 0 is the success case and not error case.
ohci_resume(hcd, false);
ret = -EBUSY;
}
if (ret)
return ret; if (time_before(jiffies, ohci->next_statechange)) msleep(5);
@@ -143,7 +153,7 @@ static int spear_ohci_hcd_drv_suspend(struct platform_device *dev,
clk_disable_unprepare(sohci_p->clk);
return 0;
return ret;
}
static int spear_ohci_hcd_drv_resume(struct platform_device *dev)
1.7.9.5
linaro-dev mailing list linaro-dev@lists.linaro.org http://lists.linaro.org/mailman/listinfo/linaro-dev
On 13 June 2013 14:49, Viresh Kumar viresh.kumar@linaro.org wrote:
On 13 June 2013 14:41, Manjunath Goudar manjunath.goudar@linaro.org wrote:
Suspend scenario in case of ohci-spear glue was not properly handled as it was not suspending generic part of ohci controller.Calling explicitly the ohci_suspend()
Add space after full stop.
routine in spear_ohci_hcd_drv_suspend() will ensure proper handling of suspend scenario.
V2: -Incase ohci_suspend() fails, return right away without executing further.
You added changelog at wrong place. This will get commited once somebody applies this patch.
Signed-off-by: Manjunath Goudar manjunath.goudar@linaro.org Cc: Arnd Bergmann arnd@arndb.de Cc: Alan Stern stern@rowland.harvard.edu Cc: Greg KH greg@kroah.com Cc: linux-usb@vger.kernel.org
Add it here.
drivers/usb/host/ohci-spear.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/host/ohci-spear.c
b/drivers/usb/host/ohci-spear.c
index 31ff3fc..2ff867b 100644 --- a/drivers/usb/host/ohci-spear.c +++ b/drivers/usb/host/ohci-spear.c @@ -130,12 +130,22 @@ static int spear_ohci_hcd_drv_remove(struct
platform_device *pdev)
}
#if defined(CONFIG_PM) -static int spear_ohci_hcd_drv_suspend(struct platform_device *dev, +static int spear_ohci_hcd_drv_suspend(struct platform_device *pdev, pm_message_t message) {
struct usb_hcd *hcd = platform_get_drvdata(dev);
struct usb_hcd *hcd = platform_get_drvdata(pdev); struct ohci_hcd *ohci = hcd_to_ohci(hcd); struct spear_ohci *sohci_p = to_spear_ohci(hcd);
bool do_wakeup = device_may_wakeup(&pdev->dev);
int ret;
ret = ohci_suspend(hcd, do_wakeup);
if (ret == 0 && do_wakeup && HCD_WAKEUP_PENDING(hcd)) {
maybe s/ret == 0/!ret
I thought ret == 0 is the success case and not error case
yes ret == 0 is success when do_wakeup=false and HCD_WAKEUP_PENDING() return 0 or any one return 0 otherwise it is fail only.
ohci_resume(hcd, false);
ret = -EBUSY;
}
if (ret)
return ret; if (time_before(jiffies, ohci->next_statechange)) msleep(5);
@@ -143,7 +153,7 @@ static int spear_ohci_hcd_drv_suspend(struct
platform_device *dev,
clk_disable_unprepare(sohci_p->clk);
return 0;
return ret;
}
static int spear_ohci_hcd_drv_resume(struct platform_device *dev)
1.7.9.5
linaro-dev mailing list linaro-dev@lists.linaro.org http://lists.linaro.org/mailman/listinfo/linaro-dev
On Thu, 13 Jun 2013, Viresh Kumar wrote:
bool do_wakeup = device_may_wakeup(&pdev->dev);
int ret;
ret = ohci_suspend(hcd, do_wakeup);
if (ret == 0 && do_wakeup && HCD_WAKEUP_PENDING(hcd)) {
maybe s/ret == 0/!ret
I tend to prefer using ! for boolean values and == 0 for numeric values. Just a matter of personal taste.
I thought ret == 0 is the success case and not error case.
ohci_resume(hcd, false);
ret = -EBUSY;
}
Yes, 0 is the success case. You must not have seen the explanation for this code; it is needed to handle a race. If the suspend succeeds but a wakeup request has already arrived, we need to undo the suspend. Obviously, if the suspend failed then there's no need to undo anything.
Alan Stern
On Thu, 13 Jun 2013, Manjunath Goudar wrote:
Suspend scenario in case of ohci-at91 glue was not properly handled as it was not suspending generic part of ohci controller. Calling explicitly the ohci_suspend() routine in ohci_hcd_at91_drv_suspend() will ensure proper handling of suspend scenario.
V2: -Incase ohci_suspend() fails, return right away without executing further.
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index fb2f127..6620e3a 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c @@ -619,8 +619,18 @@ ohci_hcd_at91_drv_suspend(struct platform_device *pdev, pm_message_t mesg) { struct usb_hcd *hcd = platform_get_drvdata(pdev); struct ohci_hcd *ohci = hcd_to_ohci(hcd);
- bool do_wakeup = device_may_wakeup(&pdev->dev);
- int ret;
Please use tab characters so that "do_wakeup" and "ret" are lined up directly beneath "*hcd" and "*ohci". The rest of this patch is okay.
Acked-by: Alan Stern stern@rowland.harvard.edu
On Thu, 13 Jun 2013, Manjunath Goudar wrote:
Suspend scenario in case of ohci-s3c2410 glue was not properly handled as it was not suspending generic part of ohci controller.Calling explicitly the ohci_suspend() routine in ohci_hcd_s3c2410_drv_suspend() will ensure proper handling of suspend scenario.
V2: -Incase ohci_suspend() fails, return right away without executing further.
diff --git a/drivers/usb/host/ohci-s3c2410.c b/drivers/usb/host/ohci-s3c2410.c index 8018bb1..01430f2 100644 --- a/drivers/usb/host/ohci-s3c2410.c +++ b/drivers/usb/host/ohci-s3c2410.c @@ -430,7 +430,15 @@ static int ohci_hcd_s3c2410_drv_suspend(struct device *dev) struct platform_device *pdev = to_platform_device(dev); unsigned long flags; int rc = 0;
- bool do_wakeup = device_may_wakeup(dev);
- rc = ohci_suspend(hcd, do_wakeup);
- if (rc == 0 && do_wakeup && HCD_WAKEUP_PENDING(hcd)) {
ohci_resume(hcd, false);
rc = -EBUSY;
- }
- if (rc)
/*return rc;
- Root hub was already suspended. Disable irq emission and
- mark HW unaccessible, bail out if RH has been resumed. Use
The part that follows this patch doesn't make sense any more. I think we can afford to get rid of the test for ohci->rh_state != OHCI_RH_SUSPENDED; the PM core has been quite stable for years and it won't try to suspend the controller if the root hub is active.
Also, the
clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
line isn't needed, because ohci_suspend() does it.
Putting this all together, all that's left is the spin_lock/unlock and the call to s3c2410_stop_hc(). The comment isn't needed, nor is the statement label. (In fact, I'm not even sure if the spin_lock/unlock lines are needed. It depends on the hardware details.)
Alan Stern
On Thu, 13 Jun 2013, Manjunath Goudar wrote:
Suspend scenario in case of ohci-da8xx glue was not properly handled as it was not suspending generic part of ohci controller.Calling explicitly the ohci_suspend() routine in ohci_da8xx_suspend() will ensure proper handling of suspend scenario.
V2: -Incase ohci_suspend() fails, return right away without executing further.
diff --git a/drivers/usb/host/ohci-da8xx.c b/drivers/usb/host/ohci-da8xx.c index 6aaa9c9..8d4914d 100644 --- a/drivers/usb/host/ohci-da8xx.c +++ b/drivers/usb/host/ohci-da8xx.c @@ -406,10 +406,21 @@ static int ohci_hcd_da8xx_drv_remove(struct platform_device *dev) } #ifdef CONFIG_PM -static int ohci_da8xx_suspend(struct platform_device *dev, pm_message_t message) +static int ohci_da8xx_suspend(struct platform_device *pdev,
pm_message_t message)
{
- struct usb_hcd *hcd = platform_get_drvdata(dev);
- struct usb_hcd *hcd = platform_get_drvdata(pdev); struct ohci_hcd *ohci = hcd_to_ohci(hcd);
- bool do_wakeup = device_may_wakeup(&pdev->dev);
- int ret;
Again, the new variables should line up with the old ones.
- ret = ohci_suspend(hcd, do_wakeup);
- if (ret == 0 && do_wakeup && HCD_WAKEUP_PENDING(hcd)) {
ohci_resume(hcd, false);
ret = -EBUSY;
- }
- if (ret)
return ret;
if (time_before(jiffies, ohci->next_statechange)) msleep(5);
This time_before and next_statechange stuff can be removed. Or if you want to keep it, the code you added should come after it.
@@ -417,8 +428,8 @@ static int ohci_da8xx_suspend(struct platform_device *dev, pm_message_t message) ohci_da8xx_clock(0); hcd->state = HC_STATE_SUSPENDED;
- dev->dev.power.power_state = PMSG_SUSPEND;
- return 0;
- pdev->dev.power.power_state = PMSG_SUSPEND;
- return ret;
}
This pdev->dev.power.power_state stuff isn't being used any more. It can be removed.
Alan Stern
Hi Manjunath,
On Thursday 13 of June 2013 14:46:24 Manjunath Goudar wrote:
Suspend scenario in case of ohci-exynos glue was not properly handled as it was not suspending generic part of ohci controller.Calling explicitly the ohci_suspend() routine in exynos_ohci_suspend() will ensure proper handling of suspend scenario.
V2: -Incase ohci_suspend() fails, return right away without executing further.
Signed-off-by: Manjunath Goudar manjunath.goudar@linaro.org Cc: Arnd Bergmann arnd@arndb.de Cc: Alan Stern stern@rowland.harvard.edu Cc: Greg KH greg@kroah.com Cc: linux-usb@vger.kernel.org
drivers/usb/host/ohci-exynos.c | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c index 6ff830c..8fecb6a 100644 --- a/drivers/usb/host/ohci-exynos.c +++ b/drivers/usb/host/ohci-exynos.c @@ -203,9 +203,17 @@ static int exynos_ohci_suspend(struct device *dev) struct exynos_ohci_hcd *exynos_ohci = to_exynos_ohci(hcd); struct ohci_hcd *ohci = hcd_to_ohci(hcd); struct platform_device *pdev = to_platform_device(dev);
bool do_wakeup = device_may_wakeup(dev); unsigned long flags; int rc = 0;
rc = ohci_suspend(hcd, do_wakeup);
if (rc == 0 && do_wakeup && HCD_WAKEUP_PENDING(hcd)) {
ohci_resume(hcd, false);
rc = -EBUSY;
}
I'm not into USB host subsystem, so I might just ask a stupid question.
Can't we make ohci_suspend check this for us, so the drivers would just check for error code? It seems like in all your patches this part of code is duplicated, looking as a good candidate to be generic.
Best regards, Tomasz
- if (rc)
/*return rc;
- Root hub was already suspended. Disable irq emission and
- mark HW unaccessible, bail out if RH has been resumed. Use
On Thu, 13 Jun 2013, Tomasz Figa wrote:
- rc = ohci_suspend(hcd, do_wakeup);
- if (rc == 0 && do_wakeup && HCD_WAKEUP_PENDING(hcd)) {
ohci_resume(hcd, false);
rc = -EBUSY;
- }
I'm not into USB host subsystem, so I might just ask a stupid question.
Can't we make ohci_suspend check this for us, so the drivers would just check for error code? It seems like in all your patches this part of code is duplicated, looking as a good candidate to be generic.
Argh! You're right, of course.
I didn't see it, because the only existing place where this check is made is in the PCI glue layer. Pushing it into the HCDs themselves is obviously the right thing to do.
Manjanuth, let's do this. You can write a preliminary patch that puts this check at the end of the ohci_suspend() routine, and then resubmit your series.
Alan Stern
Please use linaro-kernel instead of linaro-dev mailing list for sending patches.
On 13 June 2013 14:46, Manjunath Goudar manjunath.goudar@linaro.org wrote:
Suspend scenario in case of ohci bus glue was not properly handled as it was not suspending generic part of ohci controller. Calling explicitly the ohci_suspend()routine will ensure proper handling of suspend scenario.
V2: -Incase ohci_suspend() fails, return right away without executing further.
Manjunath Goudar (10): USB: OHCI: Properly handle ohci-at91 suspend USB: OHCI: Properly handle ohci-s3c2410 suspend USB: OHCI: Properly handle ohci-da8xx suspend USB: OHCI: Properly handle ohci-ep93xx suspend USB: OHCI: Properly handle ohci-exynos suspend USB: OHCI: Properly handle ohci-omap suspend USB: OHCI: Properly handle ohci-platform suspend USB: OHCI: Properly handle ohci-pxa27x suspend USB: OHCI: Properly handle ohci-sm501 suspend USB: OHCI: Properly handle ohci-spear suspend
drivers/usb/host/ohci-at91.c | 14 ++++++++++++-- drivers/usb/host/ohci-da8xx.c | 19 +++++++++++++++---- drivers/usb/host/ohci-ep93xx.c | 12 +++++++++++- drivers/usb/host/ohci-exynos.c | 8 ++++++++ drivers/usb/host/ohci-omap.c | 17 ++++++++++++++--- drivers/usb/host/ohci-platform.c | 13 ++++++++++++- drivers/usb/host/ohci-pxa27x.c | 12 +++++++++++- drivers/usb/host/ohci-s3c2410.c | 8 ++++++++ drivers/usb/host/ohci-sm501.c | 15 +++++++++++++-- drivers/usb/host/ohci-spear.c | 16 +++++++++++++--- 10 files changed, 117 insertions(+), 17 deletions(-)
-- 1.7.9.5
linaro-dev mailing list linaro-dev@lists.linaro.org http://lists.linaro.org/mailman/listinfo/linaro-dev
Hi Alan,
Can you review other patches which are left out in this series.
Manjunath Goudar
On 13 June 2013 14:46, Manjunath Goudar manjunath.goudar@linaro.org wrote:
Suspend scenario in case of ohci bus glue was not properly handled as it was not suspending generic part of ohci controller. Calling explicitly the ohci_suspend()routine will ensure proper handling of suspend scenario.
V2: -Incase ohci_suspend() fails, return right away without executing further.
Manjunath Goudar (10): USB: OHCI: Properly handle ohci-at91 suspend USB: OHCI: Properly handle ohci-s3c2410 suspend USB: OHCI: Properly handle ohci-da8xx suspend USB: OHCI: Properly handle ohci-ep93xx suspend USB: OHCI: Properly handle ohci-exynos suspend USB: OHCI: Properly handle ohci-omap suspend USB: OHCI: Properly handle ohci-platform suspend USB: OHCI: Properly handle ohci-pxa27x suspend USB: OHCI: Properly handle ohci-sm501 suspend USB: OHCI: Properly handle ohci-spear suspend
drivers/usb/host/ohci-at91.c | 14 ++++++++++++-- drivers/usb/host/ohci-da8xx.c | 19 +++++++++++++++---- drivers/usb/host/ohci-ep93xx.c | 12 +++++++++++- drivers/usb/host/ohci-exynos.c | 8 ++++++++ drivers/usb/host/ohci-omap.c | 17 ++++++++++++++--- drivers/usb/host/ohci-platform.c | 13 ++++++++++++- drivers/usb/host/ohci-pxa27x.c | 12 +++++++++++- drivers/usb/host/ohci-s3c2410.c | 8 ++++++++ drivers/usb/host/ohci-sm501.c | 15 +++++++++++++-- drivers/usb/host/ohci-spear.c | 16 +++++++++++++--- 10 files changed, 117 insertions(+), 17 deletions(-)
-- 1.7.9.5
On 14 June 2013 00:44, Alan Stern stern@rowland.harvard.edu wrote:
On Thu, 13 Jun 2013, Manjunath Goudar wrote:
Suspend scenario in case of ohci-at91 glue was not properly handled as it was not suspending generic part of ohci controller. Calling explicitly the ohci_suspend() routine in
ohci_hcd_at91_drv_suspend()
will ensure proper handling of suspend scenario.
V2: -Incase ohci_suspend() fails, return right away without executing
further.
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index fb2f127..6620e3a 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c @@ -619,8 +619,18 @@ ohci_hcd_at91_drv_suspend(struct platform_device
*pdev, pm_message_t mesg)
{ struct usb_hcd *hcd = platform_get_drvdata(pdev); struct ohci_hcd *ohci = hcd_to_ohci(hcd);
bool do_wakeup = device_may_wakeup(&pdev->dev);
int ret;
Please use tab characters so that "do_wakeup" and "ret" are lined up directly beneath "*hcd" and "*ohci". The rest of this patch is okay.
when we are using tab characters before "do_wakeup" and "ret" variable,we will be getting error below.
WARNING: please, no space before tabs #31: FILE: drivers/usb/host/ohci-at91.c:622: +^Ibool ^I^Ido_wakeup = device_may_wakeup(&pdev->dev);$
WARNING: please, no space before tabs #32: FILE: drivers/usb/host/ohci-at91.c:623: +^Iint ^I^Iret;$
total: 0 errors, 2 warnings, 27 lines checked
Acked-by: Alan Stern stern@rowland.harvard.edu
On 17 June 2013 14:52, Manjunath Goudar manjunath.goudar@linaro.org wrote:
when we are using tab characters before "do_wakeup" and "ret" variable,we will be getting error below.
WARNING: please, no space before tabs #31: FILE: drivers/usb/host/ohci-at91.c:622: +^Ibool ^I^Ido_wakeup = device_may_wakeup(&pdev->dev);$
WARNING: please, no space before tabs #32: FILE: drivers/usb/host/ohci-at91.c:623: +^Iint ^I^Iret;$
total: 0 errors, 2 warnings, 27 lines checked
That's because you are using both tabs and spaces to align. Just use multiple tabs and remove all spaces.
On 17 June 2013 14:55, Viresh Kumar viresh.kumar@linaro.org wrote:
On 17 June 2013 14:52, Manjunath Goudar manjunath.goudar@linaro.org wrote:
when we are using tab characters before "do_wakeup" and "ret"
variable,we
will be getting error below.
WARNING: please, no space before tabs #31: FILE: drivers/usb/host/ohci-at91.c:622: +^Ibool ^I^Ido_wakeup = device_may_wakeup(&pdev->dev);$
WARNING: please, no space before tabs #32: FILE: drivers/usb/host/ohci-at91.c:623: +^Iint ^I^Iret;$
total: 0 errors, 2 warnings, 27 lines checked
That's because you are using both tabs and spaces to align. Just use multiple tabs and remove all spaces.
Ya its solved,thanks
Manjunath Goudar
On 14 June 2013 01:22, Alan Stern stern@rowland.harvard.edu wrote:
On Thu, 13 Jun 2013, Tomasz Figa wrote:
- rc = ohci_suspend(hcd, do_wakeup);
- if (rc == 0 && do_wakeup && HCD_WAKEUP_PENDING(hcd)) {
ohci_resume(hcd, false);
rc = -EBUSY;
- }
I'm not into USB host subsystem, so I might just ask a stupid question.
Can't we make ohci_suspend check this for us, so the drivers would just check for error code? It seems like in all your patches this part of code is duplicated, looking as a good candidate to be generic.
Argh! You're right, of course.
I didn't see it, because the only existing place where this check is made is in the PCI glue layer. Pushing it into the HCDs themselves is obviously the right thing to do.
Manjanuth, let's do this. You can write a preliminary patch that puts this check at the end of the ohci_suspend() routine, and then resubmit your series.
Alan and Tomaszas you are correct.
Initially I also thought same, but later I analyzed this code is not necessary for all bus glue; so I did not write in ohci_suspend() routine.
After Alan explanation I am writing below code end of ohci_suspend() routine.is it correct Alan.
if (do_wakeup && HCD_WAKEUP_PENDING(hcd)) { ohci_resume(hcd, false); rc = -EBUSY; }
Alan Stern
On 18 June 2013 15:24, Manjunath Goudar manjunath.goudar@linaro.org wrote:
On 14 June 2013 01:22, Alan Stern stern@rowland.harvard.edu wrote:
On Thu, 13 Jun 2013, Tomasz Figa wrote:
- rc = ohci_suspend(hcd, do_wakeup);
- if (rc == 0 && do_wakeup && HCD_WAKEUP_PENDING(hcd)) {
ohci_resume(hcd, false);
rc = -EBUSY;
- }
I'm not into USB host subsystem, so I might just ask a stupid question.
Can't we make ohci_suspend check this for us, so the drivers would just check for error code? It seems like in all your patches this part of code is duplicated, looking as a good candidate to be generic.
Argh! You're right, of course.
I didn't see it, because the only existing place where this check is made is in the PCI glue layer. Pushing it into the HCDs themselves is obviously the right thing to do.
Manjanuth, let's do this. You can write a preliminary patch that puts this check at the end of the ohci_suspend() routine, and then resubmit your series.
Alan and Tomaszas you are correct.
Initially I also thought same, but later I analyzed this code is not necessary for all bus glue; so I did not write in ohci_suspend() routine.
After Alan explanation I am writing below code end of ohci_suspend() routine.is it correct Alan.
if (do_wakeup && HCD_WAKEUP_PENDING(hcd)) { ohci_resume(hcd, false); rc = -EBUSY;
You probably need to return this error code.
On Tue, 18 Jun 2013, Manjunath Goudar wrote:
After Alan explanation I am writing below code end of ohci_suspend() routine.is it correct Alan.
if (do_wakeup && HCD_WAKEUP_PENDING(hcd)) { ohci_resume(hcd, false); rc = -EBUSY; }
I'm glad you asked, because there is an important part I forgot about. Just before the code above, it is also necessary to add:
synchronize_irq(hcd->irq);
The reason is because a wakeup interrupt might race with the suspend call. If the suspend finishes first, we need to wait until the interrupt has been handled before checking whether there is a pending wakeup. That's what synchronize_irq() does; it waits until all the outstanding interrupt requests have been handled.
(Also, as Sachin pointed out, you have to return rc instead of 0.)
Alan Stern