All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/10] USB: OHCI:Properly handle ohci_suspend()routine in bus glue
@ 2013-06-12 15:28 Manjunath Goudar
  2013-06-12 15:28 ` [PATCH 01/10] USB: OHCI: Properly handle ohci-at91 suspend Manjunath Goudar
                   ` (15 more replies)
  0 siblings, 16 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-12 15:28 UTC (permalink / raw)
  To: linux-arm-kernel

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(-)

-- 
1.7.9.5

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

* [PATCH 01/10] USB: OHCI: Properly handle ohci-at91 suspend
  2013-06-12 15:28 [PATCH 00/10] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
@ 2013-06-12 15:28 ` Manjunath Goudar
  2013-06-12 16:04   ` Alan Stern
  2013-06-12 15:28 ` [PATCH 02/10] USB: OHCI: Properly handle ohci-s3c2410 suspend Manjunath Goudar
                   ` (14 subsequent siblings)
  15 siblings, 1 reply; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-12 15:28 UTC (permalink / raw)
  To: linux-arm-kernel

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 at 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)
-- 
1.7.9.5

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

* [PATCH 02/10] USB: OHCI: Properly handle ohci-s3c2410 suspend
  2013-06-12 15:28 [PATCH 00/10] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
  2013-06-12 15:28 ` [PATCH 01/10] USB: OHCI: Properly handle ohci-at91 suspend Manjunath Goudar
@ 2013-06-12 15:28 ` Manjunath Goudar
  2013-06-12 15:58   ` Sergei Shtylyov
  2013-06-12 15:28 ` [PATCH 03/10] USB: OHCI: Properly handle ohci-da8xx suspend Manjunath Goudar
                   ` (13 subsequent siblings)
  15 siblings, 1 reply; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-12 15:28 UTC (permalink / raw)
  To: linux-arm-kernel

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 at 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);
-- 
1.7.9.5

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

* [PATCH 03/10] USB: OHCI: Properly handle ohci-da8xx suspend
  2013-06-12 15:28 [PATCH 00/10] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
  2013-06-12 15:28 ` [PATCH 01/10] USB: OHCI: Properly handle ohci-at91 suspend Manjunath Goudar
  2013-06-12 15:28 ` [PATCH 02/10] USB: OHCI: Properly handle ohci-s3c2410 suspend Manjunath Goudar
@ 2013-06-12 15:28 ` Manjunath Goudar
  2013-06-12 15:54   ` Sergei Shtylyov
  2013-06-12 15:28 ` [PATCH 04/10] USB: OHCI: Properly handle ohci-ep93xx suspend Manjunath Goudar
                   ` (12 subsequent siblings)
  15 siblings, 1 reply; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-12 15:28 UTC (permalink / raw)
  To: linux-arm-kernel

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 at 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)
-- 
1.7.9.5

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

* [PATCH 04/10] USB: OHCI: Properly handle ohci-ep93xx suspend
  2013-06-12 15:28 [PATCH 00/10] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                   ` (2 preceding siblings ...)
  2013-06-12 15:28 ` [PATCH 03/10] USB: OHCI: Properly handle ohci-da8xx suspend Manjunath Goudar
@ 2013-06-12 15:28 ` Manjunath Goudar
  2013-06-12 15:28 ` [PATCH 05/10] USB: OHCI: Properly handle ohci-exynos suspend Manjunath Goudar
                   ` (11 subsequent siblings)
  15 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-12 15:28 UTC (permalink / raw)
  To: linux-arm-kernel

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 at 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)
-- 
1.7.9.5

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

* [PATCH 05/10] USB: OHCI: Properly handle ohci-exynos suspend
  2013-06-12 15:28 [PATCH 00/10] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                   ` (3 preceding siblings ...)
  2013-06-12 15:28 ` [PATCH 04/10] USB: OHCI: Properly handle ohci-ep93xx suspend Manjunath Goudar
@ 2013-06-12 15:28 ` Manjunath Goudar
  2013-06-12 15:28 ` [PATCH 06/10] USB: OHCI: Properly handle ohci-omap suspend Manjunath Goudar
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-12 15:28 UTC (permalink / raw)
  To: linux-arm-kernel

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 at 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:
-- 
1.7.9.5

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

* [PATCH 06/10] USB: OHCI: Properly handle ohci-omap suspend
  2013-06-12 15:28 [PATCH 00/10] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                   ` (4 preceding siblings ...)
  2013-06-12 15:28 ` [PATCH 05/10] USB: OHCI: Properly handle ohci-exynos suspend Manjunath Goudar
@ 2013-06-12 15:28 ` Manjunath Goudar
  2013-06-12 15:28 ` [PATCH 07/10] USB: OHCI: Properly handle ohci-platform suspend Manjunath Goudar
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-12 15:28 UTC (permalink / raw)
  To: linux-arm-kernel

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 at 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)
-- 
1.7.9.5

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

* [PATCH 07/10] USB: OHCI: Properly handle ohci-platform suspend
  2013-06-12 15:28 [PATCH 00/10] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                   ` (5 preceding siblings ...)
  2013-06-12 15:28 ` [PATCH 06/10] USB: OHCI: Properly handle ohci-omap suspend Manjunath Goudar
@ 2013-06-12 15:28 ` Manjunath Goudar
  2013-06-12 15:28 ` [PATCH 08/10] USB: OHCI: Properly handle ohci-pxa27x suspend Manjunath Goudar
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-12 15:28 UTC (permalink / raw)
  To: linux-arm-kernel

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 at 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)
-- 
1.7.9.5

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

* [PATCH 08/10] USB: OHCI: Properly handle ohci-pxa27x suspend
  2013-06-12 15:28 [PATCH 00/10] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                   ` (6 preceding siblings ...)
  2013-06-12 15:28 ` [PATCH 07/10] USB: OHCI: Properly handle ohci-platform suspend Manjunath Goudar
@ 2013-06-12 15:28 ` Manjunath Goudar
  2013-06-12 15:28 ` [PATCH 09/10] USB: OHCI: Properly handle ohci-sm501 suspend Manjunath Goudar
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-12 15:28 UTC (permalink / raw)
  To: linux-arm-kernel

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 at 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)
-- 
1.7.9.5

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

* [PATCH 09/10] USB: OHCI: Properly handle ohci-sm501 suspend
  2013-06-12 15:28 [PATCH 00/10] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                   ` (7 preceding siblings ...)
  2013-06-12 15:28 ` [PATCH 08/10] USB: OHCI: Properly handle ohci-pxa27x suspend Manjunath Goudar
@ 2013-06-12 15:28 ` Manjunath Goudar
  2013-06-12 15:28 ` [PATCH 10/10] USB: OHCI: Properly handle ohci-spear suspend Manjunath Goudar
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-12 15:28 UTC (permalink / raw)
  To: linux-arm-kernel

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 at 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)
-- 
1.7.9.5

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

* [PATCH 10/10] USB: OHCI: Properly handle ohci-spear suspend
  2013-06-12 15:28 [PATCH 00/10] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                   ` (8 preceding siblings ...)
  2013-06-12 15:28 ` [PATCH 09/10] USB: OHCI: Properly handle ohci-sm501 suspend Manjunath Goudar
@ 2013-06-12 15:28 ` Manjunath Goudar
  2013-06-13  9:10 ` [PATCH 00/10] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-12 15:28 UTC (permalink / raw)
  To: linux-arm-kernel

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 at 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)
-- 
1.7.9.5

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

* [PATCH 03/10] USB: OHCI: Properly handle ohci-da8xx suspend
  2013-06-12 15:28 ` [PATCH 03/10] USB: OHCI: Properly handle ohci-da8xx suspend Manjunath Goudar
@ 2013-06-12 15:54   ` Sergei Shtylyov
  0 siblings, 0 replies; 107+ messages in thread
From: Sergei Shtylyov @ 2013-06-12 15:54 UTC (permalink / raw)
  To: linux-arm-kernel

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 at 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

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

* [PATCH 02/10] USB: OHCI: Properly handle ohci-s3c2410 suspend
  2013-06-12 15:28 ` [PATCH 02/10] USB: OHCI: Properly handle ohci-s3c2410 suspend Manjunath Goudar
@ 2013-06-12 15:58   ` Sergei Shtylyov
  0 siblings, 0 replies; 107+ messages in thread
From: Sergei Shtylyov @ 2013-06-12 15:58 UTC (permalink / raw)
  To: linux-arm-kernel

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 at 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

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

* [PATCH 01/10] USB: OHCI: Properly handle ohci-at91 suspend
  2013-06-12 15:28 ` [PATCH 01/10] USB: OHCI: Properly handle ohci-at91 suspend Manjunath Goudar
@ 2013-06-12 16:04   ` Alan Stern
  2013-06-12 16:25     ` Alan Stern
  0 siblings, 1 reply; 107+ messages in thread
From: Alan Stern @ 2013-06-12 16:04 UTC (permalink / raw)
  To: linux-arm-kernel

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

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

* [PATCH 01/10] USB: OHCI: Properly handle ohci-at91 suspend
  2013-06-12 16:04   ` Alan Stern
@ 2013-06-12 16:25     ` Alan Stern
  0 siblings, 0 replies; 107+ messages in thread
From: Alan Stern @ 2013-06-12 16:25 UTC (permalink / raw)
  To: linux-arm-kernel

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

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

* [PATCH 00/10] USB: OHCI:Properly handle ohci_suspend()routine in bus glue
  2013-06-12 15:28 [PATCH 00/10] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                   ` (9 preceding siblings ...)
  2013-06-12 15:28 ` [PATCH 10/10] USB: OHCI: Properly handle ohci-spear suspend Manjunath Goudar
@ 2013-06-13  9:10 ` Manjunath Goudar
  2013-06-13  9:10   ` [PATCH 01/10] USB: OHCI: Properly handle ohci-at91 suspend Manjunath Goudar
                     ` (9 more replies)
  2013-06-13  9:16 ` [PATCH V2 00/10] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                   ` (4 subsequent siblings)
  15 siblings, 10 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-13  9:10 UTC (permalink / raw)
  To: linux-arm-kernel

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

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

* [PATCH 01/10] USB: OHCI: Properly handle ohci-at91 suspend
  2013-06-13  9:10 ` [PATCH 00/10] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
@ 2013-06-13  9:10   ` Manjunath Goudar
  2013-06-13  9:10   ` [PATCH 02/10] USB: OHCI: Properly handle ohci-s3c2410 suspend Manjunath Goudar
                     ` (8 subsequent siblings)
  9 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-13  9:10 UTC (permalink / raw)
  To: linux-arm-kernel

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 at 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)
-- 
1.7.9.5

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

* [PATCH 02/10] USB: OHCI: Properly handle ohci-s3c2410 suspend
  2013-06-13  9:10 ` [PATCH 00/10] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
  2013-06-13  9:10   ` [PATCH 01/10] USB: OHCI: Properly handle ohci-at91 suspend Manjunath Goudar
@ 2013-06-13  9:10   ` Manjunath Goudar
  2013-06-13  9:10   ` [PATCH 03/10] USB: OHCI: Properly handle ohci-da8xx suspend Manjunath Goudar
                     ` (7 subsequent siblings)
  9 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-13  9:10 UTC (permalink / raw)
  To: linux-arm-kernel

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 at 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
-- 
1.7.9.5

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

* [PATCH 03/10] USB: OHCI: Properly handle ohci-da8xx suspend
  2013-06-13  9:10 ` [PATCH 00/10] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
  2013-06-13  9:10   ` [PATCH 01/10] USB: OHCI: Properly handle ohci-at91 suspend Manjunath Goudar
  2013-06-13  9:10   ` [PATCH 02/10] USB: OHCI: Properly handle ohci-s3c2410 suspend Manjunath Goudar
@ 2013-06-13  9:10   ` Manjunath Goudar
  2013-06-13  9:10   ` [PATCH 04/10] USB: OHCI: Properly handle ohci-ep93xx suspend Manjunath Goudar
                     ` (6 subsequent siblings)
  9 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-13  9:10 UTC (permalink / raw)
  To: linux-arm-kernel

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 at 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)
-- 
1.7.9.5

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

* [PATCH 04/10] USB: OHCI: Properly handle ohci-ep93xx suspend
  2013-06-13  9:10 ` [PATCH 00/10] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                     ` (2 preceding siblings ...)
  2013-06-13  9:10   ` [PATCH 03/10] USB: OHCI: Properly handle ohci-da8xx suspend Manjunath Goudar
@ 2013-06-13  9:10   ` Manjunath Goudar
  2013-06-13  9:10   ` [PATCH 05/10] USB: OHCI: Properly handle ohci-exynos suspend Manjunath Goudar
                     ` (5 subsequent siblings)
  9 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-13  9:10 UTC (permalink / raw)
  To: linux-arm-kernel

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 at 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)
-- 
1.7.9.5

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

* [PATCH 05/10] USB: OHCI: Properly handle ohci-exynos suspend
  2013-06-13  9:10 ` [PATCH 00/10] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                     ` (3 preceding siblings ...)
  2013-06-13  9:10   ` [PATCH 04/10] USB: OHCI: Properly handle ohci-ep93xx suspend Manjunath Goudar
@ 2013-06-13  9:10   ` Manjunath Goudar
  2013-06-13  9:10   ` [PATCH 06/10] USB: OHCI: Properly handle ohci-omap suspend Manjunath Goudar
                     ` (4 subsequent siblings)
  9 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-13  9:10 UTC (permalink / raw)
  To: linux-arm-kernel

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 at 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
-- 
1.7.9.5

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

* [PATCH 06/10] USB: OHCI: Properly handle ohci-omap suspend
  2013-06-13  9:10 ` [PATCH 00/10] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                     ` (4 preceding siblings ...)
  2013-06-13  9:10   ` [PATCH 05/10] USB: OHCI: Properly handle ohci-exynos suspend Manjunath Goudar
@ 2013-06-13  9:10   ` Manjunath Goudar
  2013-06-13  9:10   ` [PATCH 07/10] USB: OHCI: Properly handle ohci-platform suspend Manjunath Goudar
                     ` (3 subsequent siblings)
  9 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-13  9:10 UTC (permalink / raw)
  To: linux-arm-kernel

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 at 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)
-- 
1.7.9.5

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

* [PATCH 07/10] USB: OHCI: Properly handle ohci-platform suspend
  2013-06-13  9:10 ` [PATCH 00/10] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                     ` (5 preceding siblings ...)
  2013-06-13  9:10   ` [PATCH 06/10] USB: OHCI: Properly handle ohci-omap suspend Manjunath Goudar
@ 2013-06-13  9:10   ` Manjunath Goudar
  2013-06-13  9:10   ` [PATCH 08/10] USB: OHCI: Properly handle ohci-pxa27x suspend Manjunath Goudar
                     ` (2 subsequent siblings)
  9 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-13  9:10 UTC (permalink / raw)
  To: linux-arm-kernel

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 at 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)
-- 
1.7.9.5

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

* [PATCH 08/10] USB: OHCI: Properly handle ohci-pxa27x suspend
  2013-06-13  9:10 ` [PATCH 00/10] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                     ` (6 preceding siblings ...)
  2013-06-13  9:10   ` [PATCH 07/10] USB: OHCI: Properly handle ohci-platform suspend Manjunath Goudar
@ 2013-06-13  9:10   ` Manjunath Goudar
  2013-06-13  9:11   ` [PATCH 09/10] USB: OHCI: Properly handle ohci-sm501 suspend Manjunath Goudar
  2013-06-13  9:11   ` [PATCH 10/10] USB: OHCI: Properly handle ohci-spear suspend Manjunath Goudar
  9 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-13  9:10 UTC (permalink / raw)
  To: linux-arm-kernel

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 at 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)
-- 
1.7.9.5

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

* [PATCH 09/10] USB: OHCI: Properly handle ohci-sm501 suspend
  2013-06-13  9:10 ` [PATCH 00/10] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                     ` (7 preceding siblings ...)
  2013-06-13  9:10   ` [PATCH 08/10] USB: OHCI: Properly handle ohci-pxa27x suspend Manjunath Goudar
@ 2013-06-13  9:11   ` Manjunath Goudar
  2013-06-13  9:11   ` [PATCH 10/10] USB: OHCI: Properly handle ohci-spear suspend Manjunath Goudar
  9 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-13  9:11 UTC (permalink / raw)
  To: linux-arm-kernel

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 at 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)
-- 
1.7.9.5

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

* [PATCH 10/10] USB: OHCI: Properly handle ohci-spear suspend
  2013-06-13  9:10 ` [PATCH 00/10] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                     ` (8 preceding siblings ...)
  2013-06-13  9:11   ` [PATCH 09/10] USB: OHCI: Properly handle ohci-sm501 suspend Manjunath Goudar
@ 2013-06-13  9:11   ` Manjunath Goudar
  2013-06-13  9:19     ` Viresh Kumar
  9 siblings, 1 reply; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-13  9:11 UTC (permalink / raw)
  To: linux-arm-kernel

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 at 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)
-- 
1.7.9.5

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

* [PATCH V2 00/10] USB: OHCI:Properly handle ohci_suspend()routine in bus glue
  2013-06-12 15:28 [PATCH 00/10] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                   ` (10 preceding siblings ...)
  2013-06-13  9:10 ` [PATCH 00/10] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
@ 2013-06-13  9:16 ` Manjunath Goudar
  2013-06-13  9:16   ` [PATCH V2 01/10] USB: OHCI: Properly handle ohci-at91 suspend Manjunath Goudar
                     ` (9 more replies)
  2013-06-19 12:12 ` [PATCH V3 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                   ` (3 subsequent siblings)
  15 siblings, 10 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-13  9:16 UTC (permalink / raw)
  To: linux-arm-kernel

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

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

* [PATCH V2 01/10] USB: OHCI: Properly handle ohci-at91 suspend
  2013-06-13  9:16 ` [PATCH V2 00/10] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
@ 2013-06-13  9:16   ` Manjunath Goudar
  2013-06-13 19:14     ` Alan Stern
  2013-06-13  9:16   ` [PATCH V2 02/10] USB: OHCI: Properly handle ohci-s3c2410 suspend Manjunath Goudar
                     ` (8 subsequent siblings)
  9 siblings, 1 reply; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-13  9:16 UTC (permalink / raw)
  To: linux-arm-kernel

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 at 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)
-- 
1.7.9.5

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

* [PATCH V2 02/10] USB: OHCI: Properly handle ohci-s3c2410 suspend
  2013-06-13  9:16 ` [PATCH V2 00/10] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
  2013-06-13  9:16   ` [PATCH V2 01/10] USB: OHCI: Properly handle ohci-at91 suspend Manjunath Goudar
@ 2013-06-13  9:16   ` Manjunath Goudar
  2013-06-13 19:20     ` Alan Stern
  2013-06-13  9:16   ` [PATCH V2 03/10] USB: OHCI: Properly handle ohci-da8xx suspend Manjunath Goudar
                     ` (7 subsequent siblings)
  9 siblings, 1 reply; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-13  9:16 UTC (permalink / raw)
  To: linux-arm-kernel

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 at 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
-- 
1.7.9.5

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

* [PATCH V2 03/10] USB: OHCI: Properly handle ohci-da8xx suspend
  2013-06-13  9:16 ` [PATCH V2 00/10] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
  2013-06-13  9:16   ` [PATCH V2 01/10] USB: OHCI: Properly handle ohci-at91 suspend Manjunath Goudar
  2013-06-13  9:16   ` [PATCH V2 02/10] USB: OHCI: Properly handle ohci-s3c2410 suspend Manjunath Goudar
@ 2013-06-13  9:16   ` Manjunath Goudar
  2013-06-13 19:26     ` Alan Stern
  2013-06-13  9:16   ` [PATCH V2 04/10] USB: OHCI: Properly handle ohci-ep93xx suspend Manjunath Goudar
                     ` (6 subsequent siblings)
  9 siblings, 1 reply; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-13  9:16 UTC (permalink / raw)
  To: linux-arm-kernel

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 at 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)
-- 
1.7.9.5

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

* [PATCH V2 04/10] USB: OHCI: Properly handle ohci-ep93xx suspend
  2013-06-13  9:16 ` [PATCH V2 00/10] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                     ` (2 preceding siblings ...)
  2013-06-13  9:16   ` [PATCH V2 03/10] USB: OHCI: Properly handle ohci-da8xx suspend Manjunath Goudar
@ 2013-06-13  9:16   ` Manjunath Goudar
  2013-06-13  9:16   ` [PATCH V2 05/10] USB: OHCI: Properly handle ohci-exynos suspend Manjunath Goudar
                     ` (5 subsequent siblings)
  9 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-13  9:16 UTC (permalink / raw)
  To: linux-arm-kernel

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 at 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)
-- 
1.7.9.5

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

* [PATCH V2 05/10] USB: OHCI: Properly handle ohci-exynos suspend
  2013-06-13  9:16 ` [PATCH V2 00/10] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                     ` (3 preceding siblings ...)
  2013-06-13  9:16   ` [PATCH V2 04/10] USB: OHCI: Properly handle ohci-ep93xx suspend Manjunath Goudar
@ 2013-06-13  9:16   ` Manjunath Goudar
  2013-06-13 19:29     ` Tomasz Figa
  2013-06-13  9:16   ` [PATCH V2 06/10] USB: OHCI: Properly handle ohci-omap suspend Manjunath Goudar
                     ` (4 subsequent siblings)
  9 siblings, 1 reply; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-13  9:16 UTC (permalink / raw)
  To: linux-arm-kernel

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 at 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
-- 
1.7.9.5

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

* [PATCH V2 06/10] USB: OHCI: Properly handle ohci-omap suspend
  2013-06-13  9:16 ` [PATCH V2 00/10] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                     ` (4 preceding siblings ...)
  2013-06-13  9:16   ` [PATCH V2 05/10] USB: OHCI: Properly handle ohci-exynos suspend Manjunath Goudar
@ 2013-06-13  9:16   ` Manjunath Goudar
  2013-06-13  9:16   ` [PATCH V2 07/10] USB: OHCI: Properly handle ohci-platform suspend Manjunath Goudar
                     ` (3 subsequent siblings)
  9 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-13  9:16 UTC (permalink / raw)
  To: linux-arm-kernel

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 at 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)
-- 
1.7.9.5

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

* [PATCH V2 07/10] USB: OHCI: Properly handle ohci-platform suspend
  2013-06-13  9:16 ` [PATCH V2 00/10] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                     ` (5 preceding siblings ...)
  2013-06-13  9:16   ` [PATCH V2 06/10] USB: OHCI: Properly handle ohci-omap suspend Manjunath Goudar
@ 2013-06-13  9:16   ` Manjunath Goudar
  2013-06-13  9:16   ` [PATCH V2 08/10] USB: OHCI: Properly handle ohci-pxa27x suspend Manjunath Goudar
                     ` (2 subsequent siblings)
  9 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-13  9:16 UTC (permalink / raw)
  To: linux-arm-kernel

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 at 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)
-- 
1.7.9.5

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

* [PATCH V2 08/10] USB: OHCI: Properly handle ohci-pxa27x suspend
  2013-06-13  9:16 ` [PATCH V2 00/10] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                     ` (6 preceding siblings ...)
  2013-06-13  9:16   ` [PATCH V2 07/10] USB: OHCI: Properly handle ohci-platform suspend Manjunath Goudar
@ 2013-06-13  9:16   ` Manjunath Goudar
  2013-06-13  9:16   ` [PATCH V2 09/10] USB: OHCI: Properly handle ohci-sm501 suspend Manjunath Goudar
  2013-06-13  9:16   ` [PATCH V2 10/10] USB: OHCI: Properly handle ohci-spear suspend Manjunath Goudar
  9 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-13  9:16 UTC (permalink / raw)
  To: linux-arm-kernel

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 at 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)
-- 
1.7.9.5

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

* [PATCH V2 09/10] USB: OHCI: Properly handle ohci-sm501 suspend
  2013-06-13  9:16 ` [PATCH V2 00/10] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                     ` (7 preceding siblings ...)
  2013-06-13  9:16   ` [PATCH V2 08/10] USB: OHCI: Properly handle ohci-pxa27x suspend Manjunath Goudar
@ 2013-06-13  9:16   ` Manjunath Goudar
  2013-06-13  9:16   ` [PATCH V2 10/10] USB: OHCI: Properly handle ohci-spear suspend Manjunath Goudar
  9 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-13  9:16 UTC (permalink / raw)
  To: linux-arm-kernel

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 at 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)
-- 
1.7.9.5

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

* [PATCH V2 10/10] USB: OHCI: Properly handle ohci-spear suspend
  2013-06-13  9:16 ` [PATCH V2 00/10] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                     ` (8 preceding siblings ...)
  2013-06-13  9:16   ` [PATCH V2 09/10] USB: OHCI: Properly handle ohci-sm501 suspend Manjunath Goudar
@ 2013-06-13  9:16   ` Manjunath Goudar
  9 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-13  9:16 UTC (permalink / raw)
  To: linux-arm-kernel

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 at 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)
-- 
1.7.9.5

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

* [PATCH 10/10] USB: OHCI: Properly handle ohci-spear suspend
  2013-06-13  9:11   ` [PATCH 10/10] USB: OHCI: Properly handle ohci-spear suspend Manjunath Goudar
@ 2013-06-13  9:19     ` Viresh Kumar
  2013-06-13 14:33       ` Alan Stern
  0 siblings, 1 reply; 107+ messages in thread
From: Viresh Kumar @ 2013-06-13  9:19 UTC (permalink / raw)
  To: linux-arm-kernel

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 at 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 at lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/linaro-dev

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

* [PATCH 10/10] USB: OHCI: Properly handle ohci-spear suspend
  2013-06-13  9:19     ` Viresh Kumar
@ 2013-06-13 14:33       ` Alan Stern
  0 siblings, 0 replies; 107+ messages in thread
From: Alan Stern @ 2013-06-13 14:33 UTC (permalink / raw)
  To: linux-arm-kernel

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

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

* [PATCH V2 01/10] USB: OHCI: Properly handle ohci-at91 suspend
  2013-06-13  9:16   ` [PATCH V2 01/10] USB: OHCI: Properly handle ohci-at91 suspend Manjunath Goudar
@ 2013-06-13 19:14     ` Alan Stern
       [not found]       ` <CAJFYCKG8i=33zXS-dhVJopaTVhCKJ_DCKo+q9wyx7CVzqzfn5g@mail.gmail.com>
  0 siblings, 1 reply; 107+ messages in thread
From: Alan Stern @ 2013-06-13 19:14 UTC (permalink / raw)
  To: linux-arm-kernel

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>

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

* [PATCH V2 02/10] USB: OHCI: Properly handle ohci-s3c2410 suspend
  2013-06-13  9:16   ` [PATCH V2 02/10] USB: OHCI: Properly handle ohci-s3c2410 suspend Manjunath Goudar
@ 2013-06-13 19:20     ` Alan Stern
  0 siblings, 0 replies; 107+ messages in thread
From: Alan Stern @ 2013-06-13 19:20 UTC (permalink / raw)
  To: linux-arm-kernel

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

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

* [PATCH V2 03/10] USB: OHCI: Properly handle ohci-da8xx suspend
  2013-06-13  9:16   ` [PATCH V2 03/10] USB: OHCI: Properly handle ohci-da8xx suspend Manjunath Goudar
@ 2013-06-13 19:26     ` Alan Stern
  0 siblings, 0 replies; 107+ messages in thread
From: Alan Stern @ 2013-06-13 19:26 UTC (permalink / raw)
  To: linux-arm-kernel

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

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

* [PATCH V2 05/10] USB: OHCI: Properly handle ohci-exynos suspend
  2013-06-13  9:16   ` [PATCH V2 05/10] USB: OHCI: Properly handle ohci-exynos suspend Manjunath Goudar
@ 2013-06-13 19:29     ` Tomasz Figa
  2013-06-13 19:52       ` Alan Stern
  0 siblings, 1 reply; 107+ messages in thread
From: Tomasz Figa @ 2013-06-13 19:29 UTC (permalink / raw)
  To: linux-arm-kernel

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 at 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

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

* [PATCH V2 05/10] USB: OHCI: Properly handle ohci-exynos suspend
  2013-06-13 19:29     ` Tomasz Figa
@ 2013-06-13 19:52       ` Alan Stern
       [not found]         ` <CAJFYCKFHhD2LuPP5LKSXzg4zuCMmNTSWRRUQkwFcQVmXSaLo9Q@mail.gmail.com>
  0 siblings, 1 reply; 107+ messages in thread
From: Alan Stern @ 2013-06-13 19:52 UTC (permalink / raw)
  To: linux-arm-kernel

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

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

* [PATCH V2 01/10] USB: OHCI: Properly handle ohci-at91 suspend
       [not found]       ` <CAJFYCKG8i=33zXS-dhVJopaTVhCKJ_DCKo+q9wyx7CVzqzfn5g@mail.gmail.com>
@ 2013-06-17  9:25         ` Viresh Kumar
  0 siblings, 0 replies; 107+ messages in thread
From: Viresh Kumar @ 2013-06-17  9:25 UTC (permalink / raw)
  To: linux-arm-kernel

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.

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

* [PATCH V2 05/10] USB: OHCI: Properly handle ohci-exynos suspend
       [not found]         ` <CAJFYCKFHhD2LuPP5LKSXzg4zuCMmNTSWRRUQkwFcQVmXSaLo9Q@mail.gmail.com>
@ 2013-06-18 10:02           ` Sachin Kamat
  2013-06-18 15:06           ` Alan Stern
  1 sibling, 0 replies; 107+ messages in thread
From: Sachin Kamat @ 2013-06-18 10:02 UTC (permalink / raw)
  To: linux-arm-kernel

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.

-- 
With warm regards,
Sachin

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

* [PATCH V2 05/10] USB: OHCI: Properly handle ohci-exynos suspend
       [not found]         ` <CAJFYCKFHhD2LuPP5LKSXzg4zuCMmNTSWRRUQkwFcQVmXSaLo9Q@mail.gmail.com>
  2013-06-18 10:02           ` Sachin Kamat
@ 2013-06-18 15:06           ` Alan Stern
  1 sibling, 0 replies; 107+ messages in thread
From: Alan Stern @ 2013-06-18 15:06 UTC (permalink / raw)
  To: linux-arm-kernel

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

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

* [PATCH V3 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue
  2013-06-12 15:28 [PATCH 00/10] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                   ` (11 preceding siblings ...)
  2013-06-13  9:16 ` [PATCH V2 00/10] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
@ 2013-06-19 12:12 ` Manjunath Goudar
  2013-06-19 12:12   ` [PATCH V3 01/11] USB: OHCI: Properly handle OHCI controller suspend Manjunath Goudar
                     ` (10 more replies)
  2013-06-20  9:35 ` [PATCH V4 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                   ` (2 subsequent siblings)
  15 siblings, 11 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-19 12:12 UTC (permalink / raw)
  To: linux-arm-kernel

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.

V3:
 -New patch 1/11 added, for generic ohci-hcd suspend code.  

Manjunath Goudar (11):
  USB: OHCI: Properly handle OHCI controller suspend
  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     |   10 ++++++++--
 drivers/usb/host/ohci-da8xx.c    |   17 ++++++++++++-----
 drivers/usb/host/ohci-ep93xx.c   |   10 +++++++++-
 drivers/usb/host/ohci-exynos.c   |   24 +++++++-----------------
 drivers/usb/host/ohci-hcd.c      |    9 ++++++++-
 drivers/usb/host/ohci-omap.c     |   13 ++++++++++---
 drivers/usb/host/ohci-platform.c |    9 ++++++++-
 drivers/usb/host/ohci-pxa27x.c   |    8 +++++++-
 drivers/usb/host/ohci-s3c2410.c  |   19 ++++---------------
 drivers/usb/host/ohci-sm501.c    |   11 +++++++++--
 drivers/usb/host/ohci-spear.c    |   12 +++++++++---
 11 files changed, 91 insertions(+), 51 deletions(-)

-- 
1.7.9.5

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

* [PATCH V3 01/11] USB: OHCI: Properly handle OHCI controller suspend
  2013-06-19 12:12 ` [PATCH V3 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
@ 2013-06-19 12:12   ` Manjunath Goudar
  2013-06-19 12:12   ` [PATCH V3 02/11] USB: OHCI: Properly handle ohci-at91 suspend Manjunath Goudar
                     ` (9 subsequent siblings)
  10 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-19 12:12 UTC (permalink / raw)
  To: linux-arm-kernel

Suspend scenario in case of OHCI was not properly
handled in ochi_suspend()routine. This does 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 at vger.kernel.org

V3: New patch.
---
 drivers/usb/host/ohci-hcd.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index b69a49e..f3dcaa2 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -1034,6 +1034,7 @@ int ohci_suspend(struct usb_hcd *hcd, bool do_wakeup)
 {
 	struct ohci_hcd	*ohci = hcd_to_ohci (hcd);
 	unsigned long	flags;
+	int		rc = 0;
 
 	/* Disable irq emission and mark HW unaccessible. Use
 	 * the spinlock to properly synchronize with possible pending
@@ -1046,7 +1047,13 @@ int ohci_suspend(struct usb_hcd *hcd, bool do_wakeup)
 	clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
 	spin_unlock_irqrestore (&ohci->lock, flags);
 
-	return 0;
+	synchronize_irq(hcd->irq);
+
+	if (do_wakeup && HCD_WAKEUP_PENDING(hcd)) {
+		ohci_resume(hcd, false);
+		rc = -EBUSY;
+	}
+	return rc;
 }
 EXPORT_SYMBOL_GPL(ohci_suspend);
 
-- 
1.7.9.5

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

* [PATCH V3 02/11] USB: OHCI: Properly handle ohci-at91 suspend
  2013-06-19 12:12 ` [PATCH V3 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
  2013-06-19 12:12   ` [PATCH V3 01/11] USB: OHCI: Properly handle OHCI controller suspend Manjunath Goudar
@ 2013-06-19 12:12   ` Manjunath Goudar
  2013-06-19 12:12   ` [PATCH V3 03/11] USB: OHCI: Properly handle ohci-s3c2410 suspend Manjunath Goudar
                     ` (8 subsequent siblings)
  10 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-19 12:12 UTC (permalink / raw)
  To: linux-arm-kernel

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>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg KH <greg@kroah.com>
Cc: linux-usb at vger.kernel.org

V2:
  -Incase ohci_suspend() fails, return right away without executing further.

V3:
 -Aligned variable "do_wakeup" and "ret".
---
 drivers/usb/host/ohci-at91.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index fb2f127..e34baa6 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -619,8 +619,14 @@ 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)
+		return ret;
+
+	if (do_wakeup)
 		enable_irq_wake(hcd->irq);
 
 	/*
@@ -637,7 +643,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)
-- 
1.7.9.5

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

* [PATCH V3 03/11] USB: OHCI: Properly handle ohci-s3c2410 suspend
  2013-06-19 12:12 ` [PATCH V3 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
  2013-06-19 12:12   ` [PATCH V3 01/11] USB: OHCI: Properly handle OHCI controller suspend Manjunath Goudar
  2013-06-19 12:12   ` [PATCH V3 02/11] USB: OHCI: Properly handle ohci-at91 suspend Manjunath Goudar
@ 2013-06-19 12:12   ` Manjunath Goudar
  2013-06-19 12:12   ` [PATCH V3 04/11] USB: OHCI: Properly handle ohci-da8xx suspend Manjunath Goudar
                     ` (7 subsequent siblings)
  10 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-19 12:12 UTC (permalink / raw)
  To: linux-arm-kernel

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 at vger.kernel.org

V2:
 -Incase ohci_suspend() fails, return right away without
  executing further.
V3:
 -rid of unwanted code from ohci_hcd_s3c2410_drv_suspend()
  which already ohci_suspend() does it.
---
 drivers/usb/host/ohci-s3c2410.c |   19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/drivers/usb/host/ohci-s3c2410.c b/drivers/usb/host/ohci-s3c2410.c
index 8018bb1..70a7ca1 100644
--- a/drivers/usb/host/ohci-s3c2410.c
+++ b/drivers/usb/host/ohci-s3c2410.c
@@ -428,26 +428,15 @@ static int ohci_hcd_s3c2410_drv_suspend(struct device *dev)
 	struct usb_hcd *hcd = dev_get_drvdata(dev);
 	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;
 
-	/*
-	 * Root hub was already suspended. Disable irq emission and
-	 * mark HW unaccessible, bail out if RH has been resumed. Use
-	 * the spinlock to properly synchronize with possible pending
-	 * RH suspend or resume activity.
-	 */
-	spin_lock_irqsave(&ohci->lock, flags);
-	if (ohci->rh_state != OHCI_RH_SUSPENDED) {
-		rc = -EINVAL;
-		goto bail;
-	}
-
-	clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
+	rc = ohci_suspend(hcd, do_wakeup);
+	if (rc)
+		return rc;
 
 	s3c2410_stop_hc(pdev);
-bail:
-	spin_unlock_irqrestore(&ohci->lock, flags);
 
 	return rc;
 }
-- 
1.7.9.5

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

* [PATCH V3 04/11] USB: OHCI: Properly handle ohci-da8xx suspend
  2013-06-19 12:12 ` [PATCH V3 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                     ` (2 preceding siblings ...)
  2013-06-19 12:12   ` [PATCH V3 03/11] USB: OHCI: Properly handle ohci-s3c2410 suspend Manjunath Goudar
@ 2013-06-19 12:12   ` Manjunath Goudar
  2013-06-19 12:12   ` [PATCH V3 05/11] USB: OHCI: Properly handle ohci-ep93xx suspend Manjunath Goudar
                     ` (6 subsequent siblings)
  10 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-19 12:12 UTC (permalink / raw)
  To: linux-arm-kernel

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 at vger.kernel.org

V2:
 -Incase ohci_suspend() fails, return right away without
  executing further.
V3:
 -Aligned variable "do_wakeup" and "ret".
 -pdev->dev.power.power_state stuff has been removed.
---
 drivers/usb/host/ohci-da8xx.c |   17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/host/ohci-da8xx.c b/drivers/usb/host/ohci-da8xx.c
index 6aaa9c9..78a6124 100644
--- a/drivers/usb/host/ohci-da8xx.c
+++ b/drivers/usb/host/ohci-da8xx.c
@@ -406,19 +406,26 @@ 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);
+	if (ret)
+		return ret;
+
+	ohci->next_statechange = jiffies;
 	ohci_da8xx_clock(0);
 	hcd->state = HC_STATE_SUSPENDED;
-	dev->dev.power.power_state = PMSG_SUSPEND;
-	return 0;
+
+	return ret;
 }
 
 static int ohci_da8xx_resume(struct platform_device *dev)
-- 
1.7.9.5

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

* [PATCH V3 05/11] USB: OHCI: Properly handle ohci-ep93xx suspend
  2013-06-19 12:12 ` [PATCH V3 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                     ` (3 preceding siblings ...)
  2013-06-19 12:12   ` [PATCH V3 04/11] USB: OHCI: Properly handle ohci-da8xx suspend Manjunath Goudar
@ 2013-06-19 12:12   ` Manjunath Goudar
  2013-06-19 12:43     ` Sergei Shtylyov
  2013-06-19 12:12   ` [PATCH V3 06/11] USB: OHCI: Properly handle ohci-exynos suspend Manjunath Goudar
                     ` (5 subsequent siblings)
  10 siblings, 1 reply; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-19 12:12 UTC (permalink / raw)
  To: linux-arm-kernel

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 at vger.kernel.org

V2:
 -Incase ohci_suspend() fails, return right away without
  executing further.
V3:
 -Aligned variable "do_wakeup" and "ret".
---
 drivers/usb/host/ohci-ep93xx.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/ohci-ep93xx.c b/drivers/usb/host/ohci-ep93xx.c
index 8704e9f..f5f11d1 100644
--- a/drivers/usb/host/ohci-ep93xx.c
+++ b/drivers/usb/host/ohci-ep93xx.c
@@ -174,13 +174,21 @@ 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;
 
 	if (time_before(jiffies, ohci->next_statechange))
 		msleep(5);
+
+	ret = ohci_suspend(hcd, do_wakeup);
+	if (ret)
+		return ret;
+
 	ohci->next_statechange = jiffies;
 
 	ep93xx_stop_hc(&pdev->dev);
-	return 0;
+
+	return ret;
 }
 
 static int ohci_hcd_ep93xx_drv_resume(struct platform_device *pdev)
-- 
1.7.9.5

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

* [PATCH V3 06/11] USB: OHCI: Properly handle ohci-exynos suspend
  2013-06-19 12:12 ` [PATCH V3 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                     ` (4 preceding siblings ...)
  2013-06-19 12:12   ` [PATCH V3 05/11] USB: OHCI: Properly handle ohci-ep93xx suspend Manjunath Goudar
@ 2013-06-19 12:12   ` Manjunath Goudar
  2013-06-19 12:47     ` Sergei Shtylyov
  2013-06-19 12:12   ` [PATCH V3 07/11] USB: OHCI: Properly handle ohci-omap suspend Manjunath Goudar
                     ` (4 subsequent siblings)
  10 siblings, 1 reply; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-19 12:12 UTC (permalink / raw)
  To: linux-arm-kernel

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 at vger.kernel.org

V2:
 -Incase ohci_suspend() fails, return right away without
  executing further.

V3:
 -rid of unwanted code from ohci_hcd_s3c2410_drv_suspend() which already
  ohci_suspend() does it.
 -Aligned variable "do_wakeup" and "ret".
---
 drivers/usb/host/ohci-exynos.c |   24 +++++++-----------------
 1 file changed, 7 insertions(+), 17 deletions(-)

diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c
index ae6068d..b5926f8 100644
--- a/drivers/usb/host/ohci-exynos.c
+++ b/drivers/usb/host/ohci-exynos.c
@@ -203,24 +203,15 @@ 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);
-	unsigned long flags;
-	int rc = 0;
+	bool		do_wakeup = device_may_wakeup(dev);
+	unsigned long	flags;
+	int		rc = 0;
 
-	/*
-	 * Root hub was already suspended. Disable irq emission and
-	 * mark HW unaccessible, bail out if RH has been resumed. Use
-	 * the spinlock to properly synchronize with possible pending
-	 * RH suspend or resume activity.
-	 */
-	spin_lock_irqsave(&ohci->lock, flags);
-	if (ohci->rh_state != OHCI_RH_SUSPENDED &&
-			ohci->rh_state != OHCI_RH_HALTED) {
-		rc = -EINVAL;
-		goto fail;
-	}
-
-	clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
+	rc = ohci_suspend(hcd, do_wakeup);
+	if (rc)
+		return rc;
 
+	spin_lock_irqsave(&ohci->lock, flags);
 	if (exynos_ohci->otg)
 		exynos_ohci->otg->set_host(exynos_ohci->otg, &hcd->self);
 
@@ -228,7 +219,6 @@ static int exynos_ohci_suspend(struct device *dev)
 
 	clk_disable_unprepare(exynos_ohci->clk);
 
-fail:
 	spin_unlock_irqrestore(&ohci->lock, flags);
 
 	return rc;
-- 
1.7.9.5

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

* [PATCH  V3 07/11] USB: OHCI: Properly handle ohci-omap suspend
  2013-06-19 12:12 ` [PATCH V3 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                     ` (5 preceding siblings ...)
  2013-06-19 12:12   ` [PATCH V3 06/11] USB: OHCI: Properly handle ohci-exynos suspend Manjunath Goudar
@ 2013-06-19 12:12   ` Manjunath Goudar
  2013-06-19 12:12   ` [PATCH V3 08/11] USB: OHCI: Properly handle ohci-platform suspend Manjunath Goudar
                     ` (3 subsequent siblings)
  10 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-19 12:12 UTC (permalink / raw)
  To: linux-arm-kernel

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 at vger.kernel.org

V2:
 -Incase ohci_suspend() fails, return right away without
  executing further.

V3:
 -Aligned variable "do_wakeup" and "ret".
---
 drivers/usb/host/ohci-omap.c |   13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c
index 10ba58d..4bd1e8f 100644
--- a/drivers/usb/host/ohci-omap.c
+++ b/drivers/usb/host/ohci-omap.c
@@ -432,16 +432,23 @@ 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);
+	if (ret)
+		return ret;
+
 	omap_ohci_clock_power(0);
-	return 0;
+	return ret;
 }
 
 static int ohci_omap_resume(struct platform_device *dev)
-- 
1.7.9.5

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

* [PATCH V3 08/11] USB: OHCI: Properly handle ohci-platform suspend
  2013-06-19 12:12 ` [PATCH V3 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                     ` (6 preceding siblings ...)
  2013-06-19 12:12   ` [PATCH V3 07/11] USB: OHCI: Properly handle ohci-omap suspend Manjunath Goudar
@ 2013-06-19 12:12   ` Manjunath Goudar
  2013-06-19 12:49     ` Sergei Shtylyov
  2013-06-19 12:12   ` [PATCH V3 09/11] USB: OHCI: Properly handle ohci-pxa27x suspend Manjunath Goudar
                     ` (2 subsequent siblings)
  10 siblings, 1 reply; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-19 12:12 UTC (permalink / raw)
  To: linux-arm-kernel

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 at vger.kernel.org

V2:
 -Incase ohci_suspend() fails, return right away without
  executing further.

V3:
 -Aligned variable "do_wakeup" and "ret".
---
 drivers/usb/host/ohci-platform.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c
index bc30475..f4830a5 100644
--- a/drivers/usb/host/ohci-platform.c
+++ b/drivers/usb/host/ohci-platform.c
@@ -139,14 +139,21 @@ 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)
+		return ret;
 
 	if (pdata->power_suspend)
 		pdata->power_suspend(pdev);
 
-	return 0;
+	return ret;
 }
 
 static int ohci_platform_resume(struct device *dev)
-- 
1.7.9.5

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

* [PATCH V3 09/11] USB: OHCI: Properly handle ohci-pxa27x suspend
  2013-06-19 12:12 ` [PATCH V3 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                     ` (7 preceding siblings ...)
  2013-06-19 12:12   ` [PATCH V3 08/11] USB: OHCI: Properly handle ohci-platform suspend Manjunath Goudar
@ 2013-06-19 12:12   ` Manjunath Goudar
  2013-06-19 12:50     ` Sergei Shtylyov
  2013-06-19 12:12   ` [PATCH V3 10/11] USB: OHCI: Properly handle ohci-sm501 suspend Manjunath Goudar
  2013-06-19 12:12   ` [PATCH V3 11/11] USB: OHCI: Properly handle ohci-spear suspend Manjunath Goudar
  10 siblings, 1 reply; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-19 12:12 UTC (permalink / raw)
  To: linux-arm-kernel

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 at vger.kernel.org

V2:
 -Incase ohci_suspend() fails, return right away without
  executing further.
V3:
 -Aligned variable "do_wakeup" and "ret".
---
 drivers/usb/host/ohci-pxa27x.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c
index 3a9c01d..1dc2a72 100644
--- a/drivers/usb/host/ohci-pxa27x.c
+++ b/drivers/usb/host/ohci-pxa27x.c
@@ -564,13 +564,19 @@ 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);
+	if (ret)
+		return ret;
+
 	pxa27x_stop_hc(ohci, dev);
-	return 0;
+	return ret;
 }
 
 static int ohci_hcd_pxa27x_drv_resume(struct device *dev)
-- 
1.7.9.5

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

* [PATCH  V3 10/11] USB: OHCI: Properly handle ohci-sm501 suspend
  2013-06-19 12:12 ` [PATCH V3 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                     ` (8 preceding siblings ...)
  2013-06-19 12:12   ` [PATCH V3 09/11] USB: OHCI: Properly handle ohci-pxa27x suspend Manjunath Goudar
@ 2013-06-19 12:12   ` Manjunath Goudar
  2013-06-19 12:12   ` [PATCH V3 11/11] USB: OHCI: Properly handle ohci-spear suspend Manjunath Goudar
  10 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-19 12:12 UTC (permalink / raw)
  To: linux-arm-kernel

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 at vger.kernel.org

V2:
 -Incase ohci_suspend() fails, return right away without
  executing further.
V3:
 -Aligned variable "do_wakeup" and "ret".
---
 drivers/usb/host/ohci-sm501.c |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/ohci-sm501.c b/drivers/usb/host/ohci-sm501.c
index d479d5d..e6c8db6 100644
--- a/drivers/usb/host/ohci-sm501.c
+++ b/drivers/usb/host/ohci-sm501.c
@@ -216,14 +216,21 @@ 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);
+	if (ret)
+		return ret;
+
 	sm501_unit_power(dev->parent, SM501_GATE_USB_HOST, 0);
-	return 0;
+	return ret;
 }
 
 static int ohci_sm501_resume(struct platform_device *pdev)
-- 
1.7.9.5

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

* [PATCH V3 11/11] USB: OHCI: Properly handle ohci-spear suspend
  2013-06-19 12:12 ` [PATCH V3 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                     ` (9 preceding siblings ...)
  2013-06-19 12:12   ` [PATCH V3 10/11] USB: OHCI: Properly handle ohci-sm501 suspend Manjunath Goudar
@ 2013-06-19 12:12   ` Manjunath Goudar
  2013-06-19 12:53     ` Sergei Shtylyov
  10 siblings, 1 reply; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-19 12:12 UTC (permalink / raw)
  To: linux-arm-kernel

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 at vger.kernel.org

V2:
 -Incase ohci_suspend() fails, return right away without
  executing further.
V3:
 -Aligned variable "do_wakeup" and "ret".
---
 drivers/usb/host/ohci-spear.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/host/ohci-spear.c b/drivers/usb/host/ohci-spear.c
index 31ff3fc..a3b2696 100644
--- a/drivers/usb/host/ohci-spear.c
+++ b/drivers/usb/host/ohci-spear.c
@@ -130,20 +130,26 @@ 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);
+	if (ret)
+		return ret;
+
 	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

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

* [PATCH V3 05/11] USB: OHCI: Properly handle ohci-ep93xx suspend
  2013-06-19 12:12   ` [PATCH V3 05/11] USB: OHCI: Properly handle ohci-ep93xx suspend Manjunath Goudar
@ 2013-06-19 12:43     ` Sergei Shtylyov
       [not found]       ` <CAJFYCKGck29t211NTmXSKPtFdah3Pbe8T0UVZDsqWqqax3OL7g@mail.gmail.com>
  0 siblings, 1 reply; 107+ messages in thread
From: Sergei Shtylyov @ 2013-06-19 12:43 UTC (permalink / raw)
  To: linux-arm-kernel

Hello.

On 19-06-2013 16:12, Manjunath Goudar wrote:

> 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 at vger.kernel.org

> V2:
>   -Incase ohci_suspend() fails, return right away without
>    executing further.
> V3:
>   -Aligned variable "do_wakeup" and "ret".
> ---
>   drivers/usb/host/ohci-ep93xx.c |   10 +++++++++-
>   1 file changed, 9 insertions(+), 1 deletion(-)

> diff --git a/drivers/usb/host/ohci-ep93xx.c b/drivers/usb/host/ohci-ep93xx.c
> index 8704e9f..f5f11d1 100644
> --- a/drivers/usb/host/ohci-ep93xx.c
> +++ b/drivers/usb/host/ohci-ep93xx.c
> @@ -174,13 +174,21 @@ 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;

    There was no need to use tabs here, didn't you see that here the 
variables aren't aligned?

WBR, Sergei

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

* [PATCH V3 06/11] USB: OHCI: Properly handle ohci-exynos suspend
  2013-06-19 12:12   ` [PATCH V3 06/11] USB: OHCI: Properly handle ohci-exynos suspend Manjunath Goudar
@ 2013-06-19 12:47     ` Sergei Shtylyov
  0 siblings, 0 replies; 107+ messages in thread
From: Sergei Shtylyov @ 2013-06-19 12:47 UTC (permalink / raw)
  To: linux-arm-kernel

On 19-06-2013 16:12, 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.

> 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 at vger.kernel.org

> V2:
>   -Incase ohci_suspend() fails, return right away without
>    executing further.

> V3:
>   -rid of unwanted code from ohci_hcd_s3c2410_drv_suspend() which already
>    ohci_suspend() does it.
>   -Aligned variable "do_wakeup" and "ret".
> ---
>   drivers/usb/host/ohci-exynos.c |   24 +++++++-----------------
>   1 file changed, 7 insertions(+), 17 deletions(-)

> diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c
> index ae6068d..b5926f8 100644
> --- a/drivers/usb/host/ohci-exynos.c
> +++ b/drivers/usb/host/ohci-exynos.c
> @@ -203,24 +203,15 @@ 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);
> -	unsigned long flags;
> -	int rc = 0;
> +	bool		do_wakeup = device_may_wakeup(dev);
> +	unsigned long	flags;
> +	int		rc = 0;

    Sigh, here there was no any alignment of variable names, why you 
aligned your variables? Doing everything with the single template? :-)

WBR, Sergei

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

* [PATCH V3 08/11] USB: OHCI: Properly handle ohci-platform suspend
  2013-06-19 12:12   ` [PATCH V3 08/11] USB: OHCI: Properly handle ohci-platform suspend Manjunath Goudar
@ 2013-06-19 12:49     ` Sergei Shtylyov
  0 siblings, 0 replies; 107+ messages in thread
From: Sergei Shtylyov @ 2013-06-19 12:49 UTC (permalink / raw)
  To: linux-arm-kernel

On 19-06-2013 16:12, Manjunath Goudar wrote:

> 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 at vger.kernel.org

> V2:
>   -Incase ohci_suspend() fails, return right away without
>    executing further.

> V3:
>   -Aligned variable "do_wakeup" and "ret".
> ---
>   drivers/usb/host/ohci-platform.c |    9 ++++++++-
>   1 file changed, 8 insertions(+), 1 deletion(-)

> diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c
> index bc30475..f4830a5 100644
> --- a/drivers/usb/host/ohci-platform.c
> +++ b/drivers/usb/host/ohci-platform.c
> @@ -139,14 +139,21 @@ 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);

    Again, the above variables weren't aligned. I bet you were just 
cut-and-pasting the same code without looking... :-/

> +	bool		do_wakeup = device_may_wakeup(dev);
> +	int		ret;

WBR, Sergei

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

* [PATCH V3 09/11] USB: OHCI: Properly handle ohci-pxa27x suspend
  2013-06-19 12:12   ` [PATCH V3 09/11] USB: OHCI: Properly handle ohci-pxa27x suspend Manjunath Goudar
@ 2013-06-19 12:50     ` Sergei Shtylyov
  0 siblings, 0 replies; 107+ messages in thread
From: Sergei Shtylyov @ 2013-06-19 12:50 UTC (permalink / raw)
  To: linux-arm-kernel

On 19-06-2013 16:12, Manjunath Goudar wrote:

> 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 at vger.kernel.org

> V2:
>   -Incase ohci_suspend() fails, return right away without
>    executing further.
> V3:
>   -Aligned variable "do_wakeup" and "ret".
> ---
>   drivers/usb/host/ohci-pxa27x.c |    8 +++++++-
>   1 file changed, 7 insertions(+), 1 deletion(-)

> diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c
> index 3a9c01d..1dc2a72 100644
> --- a/drivers/usb/host/ohci-pxa27x.c
> +++ b/drivers/usb/host/ohci-pxa27x.c
> @@ -564,13 +564,19 @@ 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;

    And again, no variable name alignment was needed.

WBR, Sergei

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

* [PATCH V3 11/11] USB: OHCI: Properly handle ohci-spear suspend
  2013-06-19 12:12   ` [PATCH V3 11/11] USB: OHCI: Properly handle ohci-spear suspend Manjunath Goudar
@ 2013-06-19 12:53     ` Sergei Shtylyov
  0 siblings, 0 replies; 107+ messages in thread
From: Sergei Shtylyov @ 2013-06-19 12:53 UTC (permalink / raw)
  To: linux-arm-kernel

On 19-06-2013 16:12, Manjunath Goudar 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()
> 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 at vger.kernel.org

> V2:
>   -Incase ohci_suspend() fails, return right away without
>    executing further.
> V3:
>   -Aligned variable "do_wakeup" and "ret".
> ---
>   drivers/usb/host/ohci-spear.c |   12 +++++++++---
>   1 file changed, 9 insertions(+), 3 deletions(-)

> diff --git a/drivers/usb/host/ohci-spear.c b/drivers/usb/host/ohci-spear.c
> index 31ff3fc..a3b2696 100644
> --- a/drivers/usb/host/ohci-spear.c
> +++ b/drivers/usb/host/ohci-spear.c
> @@ -130,20 +130,26 @@ 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;

    Sigh...

WBR, Sergei

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

* [PATCH V3 05/11] USB: OHCI: Properly handle ohci-ep93xx suspend
       [not found]       ` <CAJFYCKGck29t211NTmXSKPtFdah3Pbe8T0UVZDsqWqqax3OL7g@mail.gmail.com>
@ 2013-06-19 14:49         ` Viresh Kumar
  2013-06-19 17:33         ` Sergei Shtylyov
  1 sibling, 0 replies; 107+ messages in thread
From: Viresh Kumar @ 2013-06-19 14:49 UTC (permalink / raw)
  To: linux-arm-kernel

On 19 June 2013 20:12, Manjunath Goudar <manjunath.goudar@linaro.org> wrote:
> On 19 June 2013 18:13, Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
>> On 19-06-2013 16:12, Manjunath Goudar wrote:

>>>         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;
>>
>>
>>    There was no need to use tabs here, didn't you see that here the
>> variables aren't aligned?

> Instead of gmail you can use thunderbird mail there it is showing  proper
> alignment.

First try to understand what the actual comment is. He isn't complaining
about bad alignment but as hcd and ohci aren't aligned with tabs, you
don't require to add tabs to do_wakeup and ret.

--
viresh

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

* [PATCH V3 05/11] USB: OHCI: Properly handle ohci-ep93xx suspend
       [not found]       ` <CAJFYCKGck29t211NTmXSKPtFdah3Pbe8T0UVZDsqWqqax3OL7g@mail.gmail.com>
  2013-06-19 14:49         ` Viresh Kumar
@ 2013-06-19 17:33         ` Sergei Shtylyov
  1 sibling, 0 replies; 107+ messages in thread
From: Sergei Shtylyov @ 2013-06-19 17:33 UTC (permalink / raw)
  To: linux-arm-kernel

Hello.

On 06/19/2013 06:42 PM, Manjunath Goudar wrote:

>         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
>         <mailto:manjunath.goudar@linaro.org>>
>         Cc: Arnd Bergmann <arnd at arndb.de <mailto:arnd@arndb.de>>
>         Cc: Alan Stern <stern@rowland.harvard.edu
>         <mailto:stern@rowland.harvard.edu>>
>         Cc: Greg KH <greg at kroah.com <mailto:greg@kroah.com>>
>         Cc: linux-usb at vger.kernel.org <mailto:linux-usb@vger.kernel.org>
>
>
>         V2:
>            -Incase ohci_suspend() fails, return right away without
>             executing further.
>         V3:
>            -Aligned variable "do_wakeup" and "ret".
>         ---
>            drivers/usb/host/ohci-ep93xx.c |   10 +++++++++-
>            1 file changed, 9 insertions(+), 1 deletion(-)
>
>
>         diff --git a/drivers/usb/host/ohci-__ep93xx.c
>         b/drivers/usb/host/ohci-__ep93xx.c
>         index 8704e9f..f5f11d1 100644
>         --- a/drivers/usb/host/ohci-__ep93xx.c
>         +++ b/drivers/usb/host/ohci-__ep93xx.c
>         @@ -174,13 +174,21 @@ 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;
>

>         There was no need to use tabs here, didn't you see that here the
>     variables aren't aligned?

>     WBR, Sergei

> Instead of gmail you can use thunderbird mail there it is showing
>   proper alignment.

    Imagine, I'm using Thinderbird. :-D
    And you're using HTML reply format, unwelcome on the Linux mailing 
lists.

> Manjunath Goudar

WBR, Sergei

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

* [PATCH V4 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue
  2013-06-12 15:28 [PATCH 00/10] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                   ` (12 preceding siblings ...)
  2013-06-19 12:12 ` [PATCH V3 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
@ 2013-06-20  9:35 ` Manjunath Goudar
  2013-06-20  9:35   ` [PATCH V4 01/11] USB: OHCI: Properly handle OHCI controller suspend Manjunath Goudar
                     ` (11 more replies)
  2013-06-25  6:39 ` Manjunath Goudar
  2013-07-22  9:32 ` [PATCH 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
  15 siblings, 12 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-20  9:35 UTC (permalink / raw)
  To: linux-arm-kernel

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.

V3:
 -New patch 1/11 added, for generic ohci-hcd suspend code.
 
V4:
 -Properly aligned "do_wakeup" and "ret" variables.

Manjunath Goudar (11):
  USB: OHCI: Properly handle OHCI controller suspend
  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     |   10 ++++++++--
 drivers/usb/host/ohci-da8xx.c    |   15 +++++++++++----
 drivers/usb/host/ohci-ep93xx.c   |    9 ++++++++-
 drivers/usb/host/ohci-exynos.c   |   20 +++++---------------
 drivers/usb/host/ohci-hcd.c      |    9 ++++++++-
 drivers/usb/host/ohci-omap.c     |   13 ++++++++++---
 drivers/usb/host/ohci-platform.c |    9 ++++++++-
 drivers/usb/host/ohci-pxa27x.c   |    8 +++++++-
 drivers/usb/host/ohci-s3c2410.c  |   19 ++++---------------
 drivers/usb/host/ohci-sm501.c    |   11 +++++++++--
 drivers/usb/host/ohci-spear.c    |   12 +++++++++---
 11 files changed, 87 insertions(+), 48 deletions(-)

-- 
1.7.9.5

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

* [PATCH V4 01/11] USB: OHCI: Properly handle OHCI controller suspend
  2013-06-20  9:35 ` [PATCH V4 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
@ 2013-06-20  9:35   ` Manjunath Goudar
  2013-06-20  9:35   ` [PATCH V4 02/11] USB: OHCI: Properly handle ohci-at91 suspend Manjunath Goudar
                     ` (10 subsequent siblings)
  11 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-20  9:35 UTC (permalink / raw)
  To: linux-arm-kernel

Suspend scenario in case of OHCI was not properly
handled in ochi_suspend()routine. This does 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 at vger.kernel.org

V3: New patch.

V4: No change.
---
 drivers/usb/host/ohci-hcd.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index b69a49e..f3dcaa2 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -1034,6 +1034,7 @@ int ohci_suspend(struct usb_hcd *hcd, bool do_wakeup)
 {
 	struct ohci_hcd	*ohci = hcd_to_ohci (hcd);
 	unsigned long	flags;
+	int		rc = 0;
 
 	/* Disable irq emission and mark HW unaccessible. Use
 	 * the spinlock to properly synchronize with possible pending
@@ -1046,7 +1047,13 @@ int ohci_suspend(struct usb_hcd *hcd, bool do_wakeup)
 	clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
 	spin_unlock_irqrestore (&ohci->lock, flags);
 
-	return 0;
+	synchronize_irq(hcd->irq);
+
+	if (do_wakeup && HCD_WAKEUP_PENDING(hcd)) {
+		ohci_resume(hcd, false);
+		rc = -EBUSY;
+	}
+	return rc;
 }
 EXPORT_SYMBOL_GPL(ohci_suspend);
 
-- 
1.7.9.5

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

* [PATCH V4 02/11] USB: OHCI: Properly handle ohci-at91 suspend
  2013-06-20  9:35 ` [PATCH V4 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
  2013-06-20  9:35   ` [PATCH V4 01/11] USB: OHCI: Properly handle OHCI controller suspend Manjunath Goudar
@ 2013-06-20  9:35   ` Manjunath Goudar
  2013-06-20  9:35   ` [PATCH V4 03/11] USB: OHCI: Properly handle ohci-s3c2410 suspend Manjunath Goudar
                     ` (9 subsequent siblings)
  11 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-20  9:35 UTC (permalink / raw)
  To: linux-arm-kernel

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>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg KH <greg@kroah.com>
Cc: linux-usb at vger.kernel.org

V2:
  -Incase ohci_suspend() fails, return right away without executing further.

V3:
  -Aligned variable "do_wakeup" and "ret".

V4:
  - No change.
---
 drivers/usb/host/ohci-at91.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index fb2f127..e34baa6 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -619,8 +619,14 @@ 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)
+		return ret;
+
+	if (do_wakeup)
 		enable_irq_wake(hcd->irq);
 
 	/*
@@ -637,7 +643,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)
-- 
1.7.9.5

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

* [PATCH V4 03/11] USB: OHCI: Properly handle ohci-s3c2410 suspend
  2013-06-20  9:35 ` [PATCH V4 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
  2013-06-20  9:35   ` [PATCH V4 01/11] USB: OHCI: Properly handle OHCI controller suspend Manjunath Goudar
  2013-06-20  9:35   ` [PATCH V4 02/11] USB: OHCI: Properly handle ohci-at91 suspend Manjunath Goudar
@ 2013-06-20  9:35   ` Manjunath Goudar
  2013-06-20  9:36   ` [PATCH V4 04/11] USB: OHCI: Properly handle ohci-da8xx suspend Manjunath Goudar
                     ` (8 subsequent siblings)
  11 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-20  9:35 UTC (permalink / raw)
  To: linux-arm-kernel

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 at vger.kernel.org

V2:
 -Incase ohci_suspend() fails, return right away without
  executing further.
V3:
 -rid of unwanted code from ohci_hcd_s3c2410_drv_suspend()
  which already ohci_suspend() does it.

V4:
 -The do_wakeup variable alignment is removed.
---
 drivers/usb/host/ohci-s3c2410.c |   19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/drivers/usb/host/ohci-s3c2410.c b/drivers/usb/host/ohci-s3c2410.c
index 8018bb1..4ccf156 100644
--- a/drivers/usb/host/ohci-s3c2410.c
+++ b/drivers/usb/host/ohci-s3c2410.c
@@ -428,26 +428,15 @@ static int ohci_hcd_s3c2410_drv_suspend(struct device *dev)
 	struct usb_hcd *hcd = dev_get_drvdata(dev);
 	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;
 
-	/*
-	 * Root hub was already suspended. Disable irq emission and
-	 * mark HW unaccessible, bail out if RH has been resumed. Use
-	 * the spinlock to properly synchronize with possible pending
-	 * RH suspend or resume activity.
-	 */
-	spin_lock_irqsave(&ohci->lock, flags);
-	if (ohci->rh_state != OHCI_RH_SUSPENDED) {
-		rc = -EINVAL;
-		goto bail;
-	}
-
-	clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
+	rc = ohci_suspend(hcd, do_wakeup);
+	if (rc)
+		return rc;
 
 	s3c2410_stop_hc(pdev);
-bail:
-	spin_unlock_irqrestore(&ohci->lock, flags);
 
 	return rc;
 }
-- 
1.7.9.5

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

* [PATCH V4 04/11] USB: OHCI: Properly handle ohci-da8xx suspend
  2013-06-20  9:35 ` [PATCH V4 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                     ` (2 preceding siblings ...)
  2013-06-20  9:35   ` [PATCH V4 03/11] USB: OHCI: Properly handle ohci-s3c2410 suspend Manjunath Goudar
@ 2013-06-20  9:36   ` Manjunath Goudar
  2013-06-20 11:31     ` Sergei Shtylyov
  2013-06-20  9:36   ` [PATCH V4 05/11] USB: OHCI: Properly handle ohci-ep93xx suspend Manjunath Goudar
                     ` (7 subsequent siblings)
  11 siblings, 1 reply; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-20  9:36 UTC (permalink / raw)
  To: linux-arm-kernel

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 at vger.kernel.org

V2:
 -Incase ohci_suspend() fails, return right away without
  executing further.

V3:
 -Aligned variable "do_wakeup" and "ret".
 -pdev->dev.power.power_state stuff has been removed.

V4:
 -Properly aligned "do_wakeup" and "ret" variable.
---
 drivers/usb/host/ohci-da8xx.c |   15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/host/ohci-da8xx.c b/drivers/usb/host/ohci-da8xx.c
index 6aaa9c9..44893cf 100644
--- a/drivers/usb/host/ohci-da8xx.c
+++ b/drivers/usb/host/ohci-da8xx.c
@@ -406,19 +406,26 @@ 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);
+	if (ret)
+		return ret;
+
 	ohci_da8xx_clock(0);
 	hcd->state = HC_STATE_SUSPENDED;
-	dev->dev.power.power_state = PMSG_SUSPEND;
-	return 0;
+
+	return ret;
 }
 
 static int ohci_da8xx_resume(struct platform_device *dev)
-- 
1.7.9.5

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

* [PATCH V4 05/11] USB: OHCI: Properly handle ohci-ep93xx suspend
  2013-06-20  9:35 ` [PATCH V4 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                     ` (3 preceding siblings ...)
  2013-06-20  9:36   ` [PATCH V4 04/11] USB: OHCI: Properly handle ohci-da8xx suspend Manjunath Goudar
@ 2013-06-20  9:36   ` Manjunath Goudar
  2013-06-20  9:36   ` [PATCH V4 06/11] USB: OHCI: Properly handle ohci-exynos suspend Manjunath Goudar
                     ` (6 subsequent siblings)
  11 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-20  9:36 UTC (permalink / raw)
  To: linux-arm-kernel

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 at vger.kernel.org

V2:
 -Incase ohci_suspend() fails, return right away without
  executing further.
V3:
 -Aligned variable "do_wakeup" and "ret".
V4:
 -The do_wakeup and ret variable alignment is removed.
---
 drivers/usb/host/ohci-ep93xx.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/ohci-ep93xx.c b/drivers/usb/host/ohci-ep93xx.c
index 8704e9f..f0aaa48 100644
--- a/drivers/usb/host/ohci-ep93xx.c
+++ b/drivers/usb/host/ohci-ep93xx.c
@@ -174,13 +174,20 @@ 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;
 
 	if (time_before(jiffies, ohci->next_statechange))
 		msleep(5);
 	ohci->next_statechange = jiffies;
 
+	ret = ohci_suspend(hcd, do_wakeup);
+	if (ret)
+		return ret;
+
 	ep93xx_stop_hc(&pdev->dev);
-	return 0;
+
+	return ret;
 }
 
 static int ohci_hcd_ep93xx_drv_resume(struct platform_device *pdev)
-- 
1.7.9.5

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

* [PATCH V4 06/11] USB: OHCI: Properly handle ohci-exynos suspend
  2013-06-20  9:35 ` [PATCH V4 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                     ` (4 preceding siblings ...)
  2013-06-20  9:36   ` [PATCH V4 05/11] USB: OHCI: Properly handle ohci-ep93xx suspend Manjunath Goudar
@ 2013-06-20  9:36   ` Manjunath Goudar
  2013-06-20  9:36   ` [PATCH V4 07/11] USB: OHCI: Properly handle ohci-omap suspend Manjunath Goudar
                     ` (5 subsequent siblings)
  11 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-20  9:36 UTC (permalink / raw)
  To: linux-arm-kernel

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 at vger.kernel.org

V2:
 -Incase ohci_suspend() fails, return right away without
  executing further.

V3:
 -rid of unwanted code from ohci_hcd_s3c2410_drv_suspend() which already
  ohci_suspend() does it.
 -Aligned variable "do_wakeup" and "ret".

V4:
 -The do_wakeup and rc variable alignment is removed.
---
 drivers/usb/host/ohci-exynos.c |   20 +++++---------------
 1 file changed, 5 insertions(+), 15 deletions(-)

diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c
index ae6068d..17de3dd 100644
--- a/drivers/usb/host/ohci-exynos.c
+++ b/drivers/usb/host/ohci-exynos.c
@@ -203,24 +203,15 @@ 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;
 
-	/*
-	 * Root hub was already suspended. Disable irq emission and
-	 * mark HW unaccessible, bail out if RH has been resumed. Use
-	 * the spinlock to properly synchronize with possible pending
-	 * RH suspend or resume activity.
-	 */
-	spin_lock_irqsave(&ohci->lock, flags);
-	if (ohci->rh_state != OHCI_RH_SUSPENDED &&
-			ohci->rh_state != OHCI_RH_HALTED) {
-		rc = -EINVAL;
-		goto fail;
-	}
-
-	clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
+	rc = ohci_suspend(hcd, do_wakeup);
+	if (rc)
+		return rc;
 
+	spin_lock_irqsave(&ohci->lock, flags);
 	if (exynos_ohci->otg)
 		exynos_ohci->otg->set_host(exynos_ohci->otg, &hcd->self);
 
@@ -228,7 +219,6 @@ static int exynos_ohci_suspend(struct device *dev)
 
 	clk_disable_unprepare(exynos_ohci->clk);
 
-fail:
 	spin_unlock_irqrestore(&ohci->lock, flags);
 
 	return rc;
-- 
1.7.9.5

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

* [PATCH V4 07/11] USB: OHCI: Properly handle ohci-omap suspend
  2013-06-20  9:35 ` [PATCH V4 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                     ` (5 preceding siblings ...)
  2013-06-20  9:36   ` [PATCH V4 06/11] USB: OHCI: Properly handle ohci-exynos suspend Manjunath Goudar
@ 2013-06-20  9:36   ` Manjunath Goudar
  2013-06-20  9:36   ` [PATCH V4 08/11] USB: OHCI: Properly handle ohci-platform suspend Manjunath Goudar
                     ` (4 subsequent siblings)
  11 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-20  9:36 UTC (permalink / raw)
  To: linux-arm-kernel

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 at vger.kernel.org

V2:
 -Incase ohci_suspend() fails, return right away without
  executing further.

V3:
 -Aligned variable "do_wakeup" and "ret".

V4:
 -The do_wakeup and ret variable alignment is removed.
---
 drivers/usb/host/ohci-omap.c |   13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c
index 10ba58d..baefc46 100644
--- a/drivers/usb/host/ohci-omap.c
+++ b/drivers/usb/host/ohci-omap.c
@@ -432,16 +432,23 @@ 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);
+	if (ret)
+		return ret;
+
 	omap_ohci_clock_power(0);
-	return 0;
+	return ret;
 }
 
 static int ohci_omap_resume(struct platform_device *dev)
-- 
1.7.9.5

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

* [PATCH V4 08/11] USB: OHCI: Properly handle ohci-platform suspend
  2013-06-20  9:35 ` [PATCH V4 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                     ` (6 preceding siblings ...)
  2013-06-20  9:36   ` [PATCH V4 07/11] USB: OHCI: Properly handle ohci-omap suspend Manjunath Goudar
@ 2013-06-20  9:36   ` Manjunath Goudar
  2013-06-20  9:36   ` [PATCH V4 09/11] USB: OHCI: Properly handle ohci-pxa27x suspend Manjunath Goudar
                     ` (3 subsequent siblings)
  11 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-20  9:36 UTC (permalink / raw)
  To: linux-arm-kernel

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 at vger.kernel.org

V2:
 -Incase ohci_suspend() fails, return right away without
  executing further.

V3:
 -Aligned variable "do_wakeup" and "ret".

V4:
 -The do_wakeup and ret variable alignment is removed.
---
 drivers/usb/host/ohci-platform.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c
index bc30475..b4a8784 100644
--- a/drivers/usb/host/ohci-platform.c
+++ b/drivers/usb/host/ohci-platform.c
@@ -139,14 +139,21 @@ 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)
+		return ret;
 
 	if (pdata->power_suspend)
 		pdata->power_suspend(pdev);
 
-	return 0;
+	return ret;
 }
 
 static int ohci_platform_resume(struct device *dev)
-- 
1.7.9.5

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

* [PATCH V4 09/11] USB: OHCI: Properly handle ohci-pxa27x suspend
  2013-06-20  9:35 ` [PATCH V4 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                     ` (7 preceding siblings ...)
  2013-06-20  9:36   ` [PATCH V4 08/11] USB: OHCI: Properly handle ohci-platform suspend Manjunath Goudar
@ 2013-06-20  9:36   ` Manjunath Goudar
  2013-06-20  9:36   ` [PATCH V4 10/11] USB: OHCI: Properly handle ohci-sm501 suspend Manjunath Goudar
                     ` (2 subsequent siblings)
  11 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-20  9:36 UTC (permalink / raw)
  To: linux-arm-kernel

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 at vger.kernel.org

V2:
 -Incase ohci_suspend() fails, return right away without
  executing further.
V3:
 -Aligned variable "do_wakeup" and "ret".

V4:
 -The do_wakeup and ret variable alignment is removed.
---
 drivers/usb/host/ohci-pxa27x.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c
index 3a9c01d..5fb91f1 100644
--- a/drivers/usb/host/ohci-pxa27x.c
+++ b/drivers/usb/host/ohci-pxa27x.c
@@ -564,13 +564,19 @@ 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);
+	if (ret)
+		return ret;
+
 	pxa27x_stop_hc(ohci, dev);
-	return 0;
+	return ret;
 }
 
 static int ohci_hcd_pxa27x_drv_resume(struct device *dev)
-- 
1.7.9.5

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

* [PATCH V4 10/11] USB: OHCI: Properly handle ohci-sm501 suspend
  2013-06-20  9:35 ` [PATCH V4 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                     ` (8 preceding siblings ...)
  2013-06-20  9:36   ` [PATCH V4 09/11] USB: OHCI: Properly handle ohci-pxa27x suspend Manjunath Goudar
@ 2013-06-20  9:36   ` Manjunath Goudar
  2013-06-20  9:36   ` [PATCH V4 11/11] USB: OHCI: Properly handle ohci-spear suspend Manjunath Goudar
  2013-06-20 19:50   ` [PATCH V4 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Alan Stern
  11 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-20  9:36 UTC (permalink / raw)
  To: linux-arm-kernel

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 at vger.kernel.org

V2:
 -Incase ohci_suspend() fails, return right away without
  executing further.
V3:
 -Aligned variable "do_wakeup" and "ret".

V4:
 -The do_wakeup and ret variable alignment is removed.
---
 drivers/usb/host/ohci-sm501.c |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/ohci-sm501.c b/drivers/usb/host/ohci-sm501.c
index d479d5d..2a5de5f 100644
--- a/drivers/usb/host/ohci-sm501.c
+++ b/drivers/usb/host/ohci-sm501.c
@@ -216,14 +216,21 @@ 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);
+	if (ret)
+		return ret;
+
 	sm501_unit_power(dev->parent, SM501_GATE_USB_HOST, 0);
-	return 0;
+	return ret;
 }
 
 static int ohci_sm501_resume(struct platform_device *pdev)
-- 
1.7.9.5

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

* [PATCH V4 11/11] USB: OHCI: Properly handle ohci-spear suspend
  2013-06-20  9:35 ` [PATCH V4 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                     ` (9 preceding siblings ...)
  2013-06-20  9:36   ` [PATCH V4 10/11] USB: OHCI: Properly handle ohci-sm501 suspend Manjunath Goudar
@ 2013-06-20  9:36   ` Manjunath Goudar
  2013-06-20 19:50   ` [PATCH V4 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Alan Stern
  11 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-20  9:36 UTC (permalink / raw)
  To: linux-arm-kernel

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 at vger.kernel.org

V2:
 -Incase ohci_suspend() fails, return right away without
  executing further.
V3:
 -Aligned variable "do_wakeup" and "ret".

V4:
 -The do_wakeup and ret variable alignment is removed.
---
 drivers/usb/host/ohci-spear.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/host/ohci-spear.c b/drivers/usb/host/ohci-spear.c
index 31ff3fc..41148f8 100644
--- a/drivers/usb/host/ohci-spear.c
+++ b/drivers/usb/host/ohci-spear.c
@@ -130,20 +130,26 @@ 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);
+	if (ret)
+		return ret;
+
 	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

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

* [PATCH V4 04/11] USB: OHCI: Properly handle ohci-da8xx suspend
  2013-06-20  9:36   ` [PATCH V4 04/11] USB: OHCI: Properly handle ohci-da8xx suspend Manjunath Goudar
@ 2013-06-20 11:31     ` Sergei Shtylyov
  0 siblings, 0 replies; 107+ messages in thread
From: Sergei Shtylyov @ 2013-06-20 11:31 UTC (permalink / raw)
  To: linux-arm-kernel

Hello.

On 20-06-2013 13:36, 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 at vger.kernel.org

> V2:
>   -Incase ohci_suspend() fails, return right away without
>    executing further.

> V3:
>   -Aligned variable "do_wakeup" and "ret".
>   -pdev->dev.power.power_state stuff has been removed.

> V4:
>   -Properly aligned "do_wakeup" and "ret" variable.
> ---
>   drivers/usb/host/ohci-da8xx.c |   15 +++++++++++----
>   1 file changed, 11 insertions(+), 4 deletions(-)

> diff --git a/drivers/usb/host/ohci-da8xx.c b/drivers/usb/host/ohci-da8xx.c
> index 6aaa9c9..44893cf 100644
> --- a/drivers/usb/host/ohci-da8xx.c
> +++ b/drivers/usb/host/ohci-da8xx.c
> @@ -406,19 +406,26 @@ 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)

    Could you align this line more, so that it starts under the 
character after ( in the previous line.

>   {
> -	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;

    I wouldn't call this "properly aligned". It need one more tab.

WBR, Sergei

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

* [PATCH V4 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue
  2013-06-20  9:35 ` [PATCH V4 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                     ` (10 preceding siblings ...)
  2013-06-20  9:36   ` [PATCH V4 11/11] USB: OHCI: Properly handle ohci-spear suspend Manjunath Goudar
@ 2013-06-20 19:50   ` Alan Stern
  11 siblings, 0 replies; 107+ messages in thread
From: Alan Stern @ 2013-06-20 19:50 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, 20 Jun 2013, Manjunath Goudar 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.
> 
> V3:
>  -New patch 1/11 added, for generic ohci-hcd suspend code.
>  
> V4:
>  -Properly aligned "do_wakeup" and "ret" variables.

This whole series looks good now.  For all of the patches:

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

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

* [PATCH V4 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue
  2013-06-12 15:28 [PATCH 00/10] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                   ` (13 preceding siblings ...)
  2013-06-20  9:35 ` [PATCH V4 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
@ 2013-06-25  6:39 ` Manjunath Goudar
  2013-06-25  6:39   ` [PATCH V4 01/11] USB: OHCI: Properly handle OHCI controller suspend Manjunath Goudar
                     ` (10 more replies)
  2013-07-22  9:32 ` [PATCH 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
  15 siblings, 11 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-25  6:39 UTC (permalink / raw)
  To: linux-arm-kernel

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.

V3:
 -New patch 1/11 added, for generic ohci-hcd suspend code.

V4:
 -Properly aligned "do_wakeup" and "ret" variables.

Manjunath Goudar (11):
  USB: OHCI: Properly handle OHCI controller suspend
  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     |   10 ++++++++--
 drivers/usb/host/ohci-da8xx.c    |   15 +++++++++++----
 drivers/usb/host/ohci-ep93xx.c   |    9 ++++++++-
 drivers/usb/host/ohci-exynos.c   |   20 +++++---------------
 drivers/usb/host/ohci-hcd.c      |    9 ++++++++-
 drivers/usb/host/ohci-omap.c     |   13 ++++++++++---
 drivers/usb/host/ohci-platform.c |    9 ++++++++-
 drivers/usb/host/ohci-pxa27x.c   |    8 +++++++-
 drivers/usb/host/ohci-s3c2410.c  |   19 ++++---------------
 drivers/usb/host/ohci-sm501.c    |   11 +++++++++--
 drivers/usb/host/ohci-spear.c    |   12 +++++++++---
 11 files changed, 87 insertions(+), 48 deletions(-)

-- 
1.7.9.5

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

* [PATCH V4 01/11] USB: OHCI: Properly handle OHCI controller suspend
  2013-06-25  6:39 ` Manjunath Goudar
@ 2013-06-25  6:39   ` Manjunath Goudar
  2013-06-25  6:39   ` [PATCH V4 02/11] USB: OHCI: Properly handle ohci-at91 suspend Manjunath Goudar
                     ` (9 subsequent siblings)
  10 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-25  6:39 UTC (permalink / raw)
  To: linux-arm-kernel

Suspend scenario in case of OHCI was not properly
handled in ochi_suspend()routine. This does proper
handling of suspend scenario.

Signed-off-by: Manjunath Goudar <manjunath.goudar@linaro.org>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg KH <greg@kroah.com>
Cc: linux-usb at vger.kernel.org

V3: New patch.

V4: No change.
---
 drivers/usb/host/ohci-hcd.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index b69a49e..f3dcaa2 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -1034,6 +1034,7 @@ int ohci_suspend(struct usb_hcd *hcd, bool do_wakeup)
 {
 	struct ohci_hcd	*ohci = hcd_to_ohci (hcd);
 	unsigned long	flags;
+	int		rc = 0;
 
 	/* Disable irq emission and mark HW unaccessible. Use
 	 * the spinlock to properly synchronize with possible pending
@@ -1046,7 +1047,13 @@ int ohci_suspend(struct usb_hcd *hcd, bool do_wakeup)
 	clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
 	spin_unlock_irqrestore (&ohci->lock, flags);
 
-	return 0;
+	synchronize_irq(hcd->irq);
+
+	if (do_wakeup && HCD_WAKEUP_PENDING(hcd)) {
+		ohci_resume(hcd, false);
+		rc = -EBUSY;
+	}
+	return rc;
 }
 EXPORT_SYMBOL_GPL(ohci_suspend);
 
-- 
1.7.9.5

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

* [PATCH V4 02/11] USB: OHCI: Properly handle ohci-at91 suspend
  2013-06-25  6:39 ` Manjunath Goudar
  2013-06-25  6:39   ` [PATCH V4 01/11] USB: OHCI: Properly handle OHCI controller suspend Manjunath Goudar
@ 2013-06-25  6:39   ` Manjunath Goudar
  2013-06-25  6:39   ` [PATCH V4 03/11] USB: OHCI: Properly handle ohci-s3c2410 suspend Manjunath Goudar
                     ` (8 subsequent siblings)
  10 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-25  6:39 UTC (permalink / raw)
  To: linux-arm-kernel

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>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg KH <greg@kroah.com>
Cc: linux-usb at vger.kernel.org

V2:
  -Incase ohci_suspend() fails, return right away without executing further.

V3:
  -Aligned variable "do_wakeup" and "ret".

V4:
  - No change.
---
 drivers/usb/host/ohci-at91.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index 4c01759..09f17d1 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -618,8 +618,14 @@ 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)
+		return ret;
+
+	if (do_wakeup)
 		enable_irq_wake(hcd->irq);
 
 	/*
@@ -640,7 +646,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)
-- 
1.7.9.5

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

* [PATCH V4 03/11] USB: OHCI: Properly handle ohci-s3c2410 suspend
  2013-06-25  6:39 ` Manjunath Goudar
  2013-06-25  6:39   ` [PATCH V4 01/11] USB: OHCI: Properly handle OHCI controller suspend Manjunath Goudar
  2013-06-25  6:39   ` [PATCH V4 02/11] USB: OHCI: Properly handle ohci-at91 suspend Manjunath Goudar
@ 2013-06-25  6:39   ` Manjunath Goudar
  2013-06-25  6:39   ` [PATCH V4 04/11] USB: OHCI: Properly handle ohci-da8xx suspend Manjunath Goudar
                     ` (7 subsequent siblings)
  10 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-25  6:39 UTC (permalink / raw)
  To: linux-arm-kernel

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>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg KH <greg@kroah.com>
Cc: linux-usb at vger.kernel.org

V2:
 -Incase ohci_suspend() fails, return right away without
  executing further.
V3:
 -rid of unwanted code from ohci_hcd_s3c2410_drv_suspend()
  which already ohci_suspend() does it.

V4:
 -The do_wakeup variable alignment is removed.
---
 drivers/usb/host/ohci-s3c2410.c |   19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/drivers/usb/host/ohci-s3c2410.c b/drivers/usb/host/ohci-s3c2410.c
index b0f6644..4189aaa 100644
--- a/drivers/usb/host/ohci-s3c2410.c
+++ b/drivers/usb/host/ohci-s3c2410.c
@@ -427,26 +427,15 @@ static int ohci_hcd_s3c2410_drv_suspend(struct device *dev)
 	struct usb_hcd *hcd = dev_get_drvdata(dev);
 	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;
 
-	/*
-	 * Root hub was already suspended. Disable irq emission and
-	 * mark HW unaccessible, bail out if RH has been resumed. Use
-	 * the spinlock to properly synchronize with possible pending
-	 * RH suspend or resume activity.
-	 */
-	spin_lock_irqsave(&ohci->lock, flags);
-	if (ohci->rh_state != OHCI_RH_SUSPENDED) {
-		rc = -EINVAL;
-		goto bail;
-	}
-
-	clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
+	rc = ohci_suspend(hcd, do_wakeup);
+	if (rc)
+		return rc;
 
 	s3c2410_stop_hc(pdev);
-bail:
-	spin_unlock_irqrestore(&ohci->lock, flags);
 
 	return rc;
 }
-- 
1.7.9.5

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

* [PATCH V4 04/11] USB: OHCI: Properly handle ohci-da8xx suspend
  2013-06-25  6:39 ` Manjunath Goudar
                     ` (2 preceding siblings ...)
  2013-06-25  6:39   ` [PATCH V4 03/11] USB: OHCI: Properly handle ohci-s3c2410 suspend Manjunath Goudar
@ 2013-06-25  6:39   ` Manjunath Goudar
  2013-06-25  6:39   ` [PATCH V4 05/11] USB: OHCI: Properly handle ohci-ep93xx suspend Manjunath Goudar
                     ` (6 subsequent siblings)
  10 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-25  6:39 UTC (permalink / raw)
  To: linux-arm-kernel

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>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg KH <greg@kroah.com>
Cc: linux-usb at vger.kernel.org

V2:
 -Incase ohci_suspend() fails, return right away without
  executing further.

V3:
 -Aligned variable "do_wakeup" and "ret".
 -pdev->dev.power.power_state stuff has been removed.

V4:
 -Properly aligned "do_wakeup" and "ret" variable.
---
 drivers/usb/host/ohci-da8xx.c |   15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/host/ohci-da8xx.c b/drivers/usb/host/ohci-da8xx.c
index 6aaa9c9..c649a35 100644
--- a/drivers/usb/host/ohci-da8xx.c
+++ b/drivers/usb/host/ohci-da8xx.c
@@ -406,19 +406,26 @@ 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);
+	if (ret)
+		return ret;
+
 	ohci_da8xx_clock(0);
 	hcd->state = HC_STATE_SUSPENDED;
-	dev->dev.power.power_state = PMSG_SUSPEND;
-	return 0;
+
+	return ret;
 }
 
 static int ohci_da8xx_resume(struct platform_device *dev)
-- 
1.7.9.5

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

* [PATCH V4 05/11] USB: OHCI: Properly handle ohci-ep93xx suspend
  2013-06-25  6:39 ` Manjunath Goudar
                     ` (3 preceding siblings ...)
  2013-06-25  6:39   ` [PATCH V4 04/11] USB: OHCI: Properly handle ohci-da8xx suspend Manjunath Goudar
@ 2013-06-25  6:39   ` Manjunath Goudar
  2013-06-25  6:39   ` [PATCH V4 06/11] USB: OHCI: Properly handle ohci-exynos suspend Manjunath Goudar
                     ` (5 subsequent siblings)
  10 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-25  6:39 UTC (permalink / raw)
  To: linux-arm-kernel

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>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg KH <greg@kroah.com>
Cc: linux-usb at vger.kernel.org

V2:
 -Incase ohci_suspend() fails, return right away without
  executing further.
V3:
 -Aligned variable "do_wakeup" and "ret".
V4:
 -The do_wakeup and ret variable alignment is removed.
---
 drivers/usb/host/ohci-ep93xx.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/ohci-ep93xx.c b/drivers/usb/host/ohci-ep93xx.c
index 8704e9f..f0aaa48 100644
--- a/drivers/usb/host/ohci-ep93xx.c
+++ b/drivers/usb/host/ohci-ep93xx.c
@@ -174,13 +174,20 @@ 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;
 
 	if (time_before(jiffies, ohci->next_statechange))
 		msleep(5);
 	ohci->next_statechange = jiffies;
 
+	ret = ohci_suspend(hcd, do_wakeup);
+	if (ret)
+		return ret;
+
 	ep93xx_stop_hc(&pdev->dev);
-	return 0;
+
+	return ret;
 }
 
 static int ohci_hcd_ep93xx_drv_resume(struct platform_device *pdev)
-- 
1.7.9.5

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

* [PATCH V4 06/11] USB: OHCI: Properly handle ohci-exynos suspend
  2013-06-25  6:39 ` Manjunath Goudar
                     ` (4 preceding siblings ...)
  2013-06-25  6:39   ` [PATCH V4 05/11] USB: OHCI: Properly handle ohci-ep93xx suspend Manjunath Goudar
@ 2013-06-25  6:39   ` Manjunath Goudar
  2013-06-25  6:39   ` [PATCH V4 07/11] USB: OHCI: Properly handle ohci-omap suspend Manjunath Goudar
                     ` (4 subsequent siblings)
  10 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-25  6:39 UTC (permalink / raw)
  To: linux-arm-kernel

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>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg KH <greg@kroah.com>
Cc: linux-usb at vger.kernel.org

V2:
 -Incase ohci_suspend() fails, return right away without
  executing further.

V3:
 -rid of unwanted code from ohci_hcd_s3c2410_drv_suspend() which already
  ohci_suspend() does it.
 -Aligned variable "do_wakeup" and "ret".

V4:
 -The do_wakeup and rc variable alignment is removed.
---
 drivers/usb/host/ohci-exynos.c |   20 +++++---------------
 1 file changed, 5 insertions(+), 15 deletions(-)

diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c
index ae6068d..17de3dd 100644
--- a/drivers/usb/host/ohci-exynos.c
+++ b/drivers/usb/host/ohci-exynos.c
@@ -203,24 +203,15 @@ 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;
 
-	/*
-	 * Root hub was already suspended. Disable irq emission and
-	 * mark HW unaccessible, bail out if RH has been resumed. Use
-	 * the spinlock to properly synchronize with possible pending
-	 * RH suspend or resume activity.
-	 */
-	spin_lock_irqsave(&ohci->lock, flags);
-	if (ohci->rh_state != OHCI_RH_SUSPENDED &&
-			ohci->rh_state != OHCI_RH_HALTED) {
-		rc = -EINVAL;
-		goto fail;
-	}
-
-	clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
+	rc = ohci_suspend(hcd, do_wakeup);
+	if (rc)
+		return rc;
 
+	spin_lock_irqsave(&ohci->lock, flags);
 	if (exynos_ohci->otg)
 		exynos_ohci->otg->set_host(exynos_ohci->otg, &hcd->self);
 
@@ -228,7 +219,6 @@ static int exynos_ohci_suspend(struct device *dev)
 
 	clk_disable_unprepare(exynos_ohci->clk);
 
-fail:
 	spin_unlock_irqrestore(&ohci->lock, flags);
 
 	return rc;
-- 
1.7.9.5

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

* [PATCH V4 07/11] USB: OHCI: Properly handle ohci-omap suspend
  2013-06-25  6:39 ` Manjunath Goudar
                     ` (5 preceding siblings ...)
  2013-06-25  6:39   ` [PATCH V4 06/11] USB: OHCI: Properly handle ohci-exynos suspend Manjunath Goudar
@ 2013-06-25  6:39   ` Manjunath Goudar
  2013-06-25  6:39   ` [PATCH V4 08/11] USB: OHCI: Properly handle ohci-platform suspend Manjunath Goudar
                     ` (3 subsequent siblings)
  10 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-25  6:39 UTC (permalink / raw)
  To: linux-arm-kernel

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>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg KH <greg@kroah.com>
Cc: linux-usb at vger.kernel.org

V2:
 -Incase ohci_suspend() fails, return right away without
  executing further.

V3:
 -Aligned variable "do_wakeup" and "ret".

V4:
 -The do_wakeup and ret variable alignment is removed.
---
 drivers/usb/host/ohci-omap.c |   13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c
index 10ba58d..baefc46 100644
--- a/drivers/usb/host/ohci-omap.c
+++ b/drivers/usb/host/ohci-omap.c
@@ -432,16 +432,23 @@ 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);
+	if (ret)
+		return ret;
+
 	omap_ohci_clock_power(0);
-	return 0;
+	return ret;
 }
 
 static int ohci_omap_resume(struct platform_device *dev)
-- 
1.7.9.5

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

* [PATCH V4 08/11] USB: OHCI: Properly handle ohci-platform suspend
  2013-06-25  6:39 ` Manjunath Goudar
                     ` (6 preceding siblings ...)
  2013-06-25  6:39   ` [PATCH V4 07/11] USB: OHCI: Properly handle ohci-omap suspend Manjunath Goudar
@ 2013-06-25  6:39   ` Manjunath Goudar
  2013-06-25  6:39   ` [PATCH V4 09/11] USB: OHCI: Properly handle ohci-pxa27x suspend Manjunath Goudar
                     ` (2 subsequent siblings)
  10 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-25  6:39 UTC (permalink / raw)
  To: linux-arm-kernel

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>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg KH <greg@kroah.com>
Cc: linux-usb at vger.kernel.org

V2:
 -Incase ohci_suspend() fails, return right away without
  executing further.

V3:
 -Aligned variable "do_wakeup" and "ret".

V4:
 -The do_wakeup and ret variable alignment is removed.
---
 drivers/usb/host/ohci-platform.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c
index bc30475..b4a8784 100644
--- a/drivers/usb/host/ohci-platform.c
+++ b/drivers/usb/host/ohci-platform.c
@@ -139,14 +139,21 @@ 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)
+		return ret;
 
 	if (pdata->power_suspend)
 		pdata->power_suspend(pdev);
 
-	return 0;
+	return ret;
 }
 
 static int ohci_platform_resume(struct device *dev)
-- 
1.7.9.5

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

* [PATCH V4 09/11] USB: OHCI: Properly handle ohci-pxa27x suspend
  2013-06-25  6:39 ` Manjunath Goudar
                     ` (7 preceding siblings ...)
  2013-06-25  6:39   ` [PATCH V4 08/11] USB: OHCI: Properly handle ohci-platform suspend Manjunath Goudar
@ 2013-06-25  6:39   ` Manjunath Goudar
  2013-06-25  6:39   ` [PATCH V4 10/11] USB: OHCI: Properly handle ohci-sm501 suspend Manjunath Goudar
  2013-06-25  6:39   ` [PATCH V4 11/11] USB: OHCI: Properly handle ohci-spear suspend Manjunath Goudar
  10 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-25  6:39 UTC (permalink / raw)
  To: linux-arm-kernel

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>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg KH <greg@kroah.com>
Cc: linux-usb at vger.kernel.org

V2:
 -Incase ohci_suspend() fails, return right away without
  executing further.
V3:
 -Aligned variable "do_wakeup" and "ret".

V4:
 -The do_wakeup and ret variable alignment is removed.
---
 drivers/usb/host/ohci-pxa27x.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c
index 3a9c01d..5fb91f1 100644
--- a/drivers/usb/host/ohci-pxa27x.c
+++ b/drivers/usb/host/ohci-pxa27x.c
@@ -564,13 +564,19 @@ 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);
+	if (ret)
+		return ret;
+
 	pxa27x_stop_hc(ohci, dev);
-	return 0;
+	return ret;
 }
 
 static int ohci_hcd_pxa27x_drv_resume(struct device *dev)
-- 
1.7.9.5

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

* [PATCH V4 10/11] USB: OHCI: Properly handle ohci-sm501 suspend
  2013-06-25  6:39 ` Manjunath Goudar
                     ` (8 preceding siblings ...)
  2013-06-25  6:39   ` [PATCH V4 09/11] USB: OHCI: Properly handle ohci-pxa27x suspend Manjunath Goudar
@ 2013-06-25  6:39   ` Manjunath Goudar
  2013-06-25  6:39   ` [PATCH V4 11/11] USB: OHCI: Properly handle ohci-spear suspend Manjunath Goudar
  10 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-25  6:39 UTC (permalink / raw)
  To: linux-arm-kernel

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>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg KH <greg@kroah.com>
Cc: linux-usb at vger.kernel.org

V2:
 -Incase ohci_suspend() fails, return right away without
  executing further.
V3:
 -Aligned variable "do_wakeup" and "ret".

-V4:
 -The do_wakeup and ret variable alignment is removed.
---
 drivers/usb/host/ohci-sm501.c |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/ohci-sm501.c b/drivers/usb/host/ohci-sm501.c
index d479d5d..2a5de5f 100644
--- a/drivers/usb/host/ohci-sm501.c
+++ b/drivers/usb/host/ohci-sm501.c
@@ -216,14 +216,21 @@ 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);
+	if (ret)
+		return ret;
+
 	sm501_unit_power(dev->parent, SM501_GATE_USB_HOST, 0);
-	return 0;
+	return ret;
 }
 
 static int ohci_sm501_resume(struct platform_device *pdev)
-- 
1.7.9.5

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

* [PATCH V4 11/11] USB: OHCI: Properly handle ohci-spear suspend
  2013-06-25  6:39 ` Manjunath Goudar
                     ` (9 preceding siblings ...)
  2013-06-25  6:39   ` [PATCH V4 10/11] USB: OHCI: Properly handle ohci-sm501 suspend Manjunath Goudar
@ 2013-06-25  6:39   ` Manjunath Goudar
  10 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-06-25  6:39 UTC (permalink / raw)
  To: linux-arm-kernel

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>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg KH <greg@kroah.com>
Cc: linux-usb at vger.kernel.org

V2:
 -Incase ohci_suspend() fails, return right away without
  executing further.
V3:
 -Aligned variable "do_wakeup" and "ret".

V4:
 -The do_wakeup and ret variable alignment is removed.
---
 drivers/usb/host/ohci-spear.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/host/ohci-spear.c b/drivers/usb/host/ohci-spear.c
index 31ff3fc..41148f8 100644
--- a/drivers/usb/host/ohci-spear.c
+++ b/drivers/usb/host/ohci-spear.c
@@ -130,20 +130,26 @@ 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);
+	if (ret)
+		return ret;
+
 	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

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

* [PATCH 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue
  2013-06-12 15:28 [PATCH 00/10] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                   ` (14 preceding siblings ...)
  2013-06-25  6:39 ` Manjunath Goudar
@ 2013-07-22  9:32 ` Manjunath Goudar
  2013-07-22  9:32   ` [PATCH 01/11] USB: OHCI: Properly handle OHCI controller suspend Manjunath Goudar
                     ` (11 more replies)
  15 siblings, 12 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-07-22  9:32 UTC (permalink / raw)
  To: linux-arm-kernel

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.

V3:
 -New patch 1/11 added, for generic ohci-hcd suspend code.

V4:
 -Properly aligned "do_wakeup" and "ret" variables.

Manjunath Goudar (11):
  USB: OHCI: Properly handle OHCI controller suspend
  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     |   10 ++++++++--
 drivers/usb/host/ohci-da8xx.c    |   15 +++++++++++----
 drivers/usb/host/ohci-ep93xx.c   |    9 ++++++++-
 drivers/usb/host/ohci-exynos.c   |   20 +++++---------------
 drivers/usb/host/ohci-hcd.c      |    9 ++++++++-
 drivers/usb/host/ohci-omap.c     |   13 ++++++++++---
 drivers/usb/host/ohci-platform.c |    9 ++++++++-
 drivers/usb/host/ohci-pxa27x.c   |    8 +++++++-
 drivers/usb/host/ohci-s3c2410.c  |   19 ++++---------------
 drivers/usb/host/ohci-sm501.c    |   11 +++++++++--
 drivers/usb/host/ohci-spear.c    |   12 +++++++++---
 11 files changed, 87 insertions(+), 48 deletions(-)

-- 
1.7.9.5

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

* [PATCH 01/11] USB: OHCI: Properly handle OHCI controller suspend
  2013-07-22  9:32 ` [PATCH 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
@ 2013-07-22  9:32   ` Manjunath Goudar
  2013-07-22  9:32   ` [PATCH 02/11] USB: OHCI: Properly handle ohci-at91 suspend Manjunath Goudar
                     ` (10 subsequent siblings)
  11 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-07-22  9:32 UTC (permalink / raw)
  To: linux-arm-kernel

Suspend scenario in case of OHCI was not properly
handled in ochi_suspend()routine. This does proper
handling of suspend scenario.

Signed-off-by: Manjunath Goudar <manjunath.goudar@linaro.org>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg KH <greg@kroah.com>
Cc: linux-usb at vger.kernel.org

V3: New patch.

V4: No change.
---
 drivers/usb/host/ohci-hcd.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index b69a49e..f3dcaa2 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -1034,6 +1034,7 @@ int ohci_suspend(struct usb_hcd *hcd, bool do_wakeup)
 {
 	struct ohci_hcd	*ohci = hcd_to_ohci (hcd);
 	unsigned long	flags;
+	int		rc = 0;
 
 	/* Disable irq emission and mark HW unaccessible. Use
 	 * the spinlock to properly synchronize with possible pending
@@ -1046,7 +1047,13 @@ int ohci_suspend(struct usb_hcd *hcd, bool do_wakeup)
 	clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
 	spin_unlock_irqrestore (&ohci->lock, flags);
 
-	return 0;
+	synchronize_irq(hcd->irq);
+
+	if (do_wakeup && HCD_WAKEUP_PENDING(hcd)) {
+		ohci_resume(hcd, false);
+		rc = -EBUSY;
+	}
+	return rc;
 }
 EXPORT_SYMBOL_GPL(ohci_suspend);
 
-- 
1.7.9.5

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

* [PATCH 02/11] USB: OHCI: Properly handle ohci-at91 suspend
  2013-07-22  9:32 ` [PATCH 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
  2013-07-22  9:32   ` [PATCH 01/11] USB: OHCI: Properly handle OHCI controller suspend Manjunath Goudar
@ 2013-07-22  9:32   ` Manjunath Goudar
  2013-07-22  9:32   ` [PATCH 03/11] USB: OHCI: Properly handle ohci-s3c2410 suspend Manjunath Goudar
                     ` (9 subsequent siblings)
  11 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-07-22  9:32 UTC (permalink / raw)
  To: linux-arm-kernel

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>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg KH <greg@kroah.com>
Cc: linux-usb at vger.kernel.org

V2:
  -Incase ohci_suspend() fails, return right away without executing further.

V3:
  -Aligned variable "do_wakeup" and "ret".

V4:
  - No change.
---
 drivers/usb/host/ohci-at91.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index 08e28eb..008645c 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -618,8 +618,14 @@ 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)
+		return ret;
+
+	if (do_wakeup)
 		enable_irq_wake(hcd->irq);
 
 	/*
@@ -640,7 +646,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)
-- 
1.7.9.5

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

* [PATCH 03/11] USB: OHCI: Properly handle ohci-s3c2410 suspend
  2013-07-22  9:32 ` [PATCH 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
  2013-07-22  9:32   ` [PATCH 01/11] USB: OHCI: Properly handle OHCI controller suspend Manjunath Goudar
  2013-07-22  9:32   ` [PATCH 02/11] USB: OHCI: Properly handle ohci-at91 suspend Manjunath Goudar
@ 2013-07-22  9:32   ` Manjunath Goudar
  2013-07-22  9:32   ` [PATCH 04/11] USB: OHCI: Properly handle ohci-da8xx suspend Manjunath Goudar
                     ` (8 subsequent siblings)
  11 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-07-22  9:32 UTC (permalink / raw)
  To: linux-arm-kernel

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>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg KH <greg@kroah.com>
Cc: linux-usb at vger.kernel.org

V2:
 -Incase ohci_suspend() fails, return right away without
  executing further.
V3:
 -rid of unwanted code from ohci_hcd_s3c2410_drv_suspend()
  which already ohci_suspend() does it.

V4:
 -The do_wakeup variable alignment is removed.
---
 drivers/usb/host/ohci-s3c2410.c |   19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/drivers/usb/host/ohci-s3c2410.c b/drivers/usb/host/ohci-s3c2410.c
index 48b5948..d4cdf9c 100644
--- a/drivers/usb/host/ohci-s3c2410.c
+++ b/drivers/usb/host/ohci-s3c2410.c
@@ -427,26 +427,15 @@ static int ohci_hcd_s3c2410_drv_suspend(struct device *dev)
 	struct usb_hcd *hcd = dev_get_drvdata(dev);
 	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;
 
-	/*
-	 * Root hub was already suspended. Disable irq emission and
-	 * mark HW unaccessible, bail out if RH has been resumed. Use
-	 * the spinlock to properly synchronize with possible pending
-	 * RH suspend or resume activity.
-	 */
-	spin_lock_irqsave(&ohci->lock, flags);
-	if (ohci->rh_state != OHCI_RH_SUSPENDED) {
-		rc = -EINVAL;
-		goto bail;
-	}
-
-	clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
+	rc = ohci_suspend(hcd, do_wakeup);
+	if (rc)
+		return rc;
 
 	s3c2410_stop_hc(pdev);
-bail:
-	spin_unlock_irqrestore(&ohci->lock, flags);
 
 	return rc;
 }
-- 
1.7.9.5

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

* [PATCH 04/11] USB: OHCI: Properly handle ohci-da8xx suspend
  2013-07-22  9:32 ` [PATCH 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                     ` (2 preceding siblings ...)
  2013-07-22  9:32   ` [PATCH 03/11] USB: OHCI: Properly handle ohci-s3c2410 suspend Manjunath Goudar
@ 2013-07-22  9:32   ` Manjunath Goudar
  2013-07-22 12:18     ` Sergei Shtylyov
  2013-07-22  9:32   ` [PATCH 05/11] USB: OHCI: Properly handle ohci-ep93xx suspend Manjunath Goudar
                     ` (7 subsequent siblings)
  11 siblings, 1 reply; 107+ messages in thread
From: Manjunath Goudar @ 2013-07-22  9:32 UTC (permalink / raw)
  To: linux-arm-kernel

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>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg KH <greg@kroah.com>
Cc: linux-usb at vger.kernel.org

V2:
 -Incase ohci_suspend() fails, return right away without
  executing further.

V3:
 -Aligned variable "do_wakeup" and "ret".
 -pdev->dev.power.power_state stuff has been removed.

V4:
 -Properly aligned "do_wakeup" and "ret" variable.
---
 drivers/usb/host/ohci-da8xx.c |   15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/host/ohci-da8xx.c b/drivers/usb/host/ohci-da8xx.c
index 6aaa9c9..c649a35 100644
--- a/drivers/usb/host/ohci-da8xx.c
+++ b/drivers/usb/host/ohci-da8xx.c
@@ -406,19 +406,26 @@ 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);
+	if (ret)
+		return ret;
+
 	ohci_da8xx_clock(0);
 	hcd->state = HC_STATE_SUSPENDED;
-	dev->dev.power.power_state = PMSG_SUSPEND;
-	return 0;
+
+	return ret;
 }
 
 static int ohci_da8xx_resume(struct platform_device *dev)
-- 
1.7.9.5

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

* [PATCH 05/11] USB: OHCI: Properly handle ohci-ep93xx suspend
  2013-07-22  9:32 ` [PATCH 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                     ` (3 preceding siblings ...)
  2013-07-22  9:32   ` [PATCH 04/11] USB: OHCI: Properly handle ohci-da8xx suspend Manjunath Goudar
@ 2013-07-22  9:32   ` Manjunath Goudar
  2013-07-22  9:32   ` [PATCH 06/11] USB: OHCI: Properly handle ohci-exynos suspend Manjunath Goudar
                     ` (6 subsequent siblings)
  11 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-07-22  9:32 UTC (permalink / raw)
  To: linux-arm-kernel

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>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg KH <greg@kroah.com>
Cc: linux-usb at vger.kernel.org

V2:
 -Incase ohci_suspend() fails, return right away without
  executing further.
V3:
 -Aligned variable "do_wakeup" and "ret".
V4:
 -The do_wakeup and ret variable alignment is removed.
---
 drivers/usb/host/ohci-ep93xx.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/ohci-ep93xx.c b/drivers/usb/host/ohci-ep93xx.c
index 8704e9f..f0aaa48 100644
--- a/drivers/usb/host/ohci-ep93xx.c
+++ b/drivers/usb/host/ohci-ep93xx.c
@@ -174,13 +174,20 @@ 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;
 
 	if (time_before(jiffies, ohci->next_statechange))
 		msleep(5);
 	ohci->next_statechange = jiffies;
 
+	ret = ohci_suspend(hcd, do_wakeup);
+	if (ret)
+		return ret;
+
 	ep93xx_stop_hc(&pdev->dev);
-	return 0;
+
+	return ret;
 }
 
 static int ohci_hcd_ep93xx_drv_resume(struct platform_device *pdev)
-- 
1.7.9.5

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

* [PATCH 06/11] USB: OHCI: Properly handle ohci-exynos suspend
  2013-07-22  9:32 ` [PATCH 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                     ` (4 preceding siblings ...)
  2013-07-22  9:32   ` [PATCH 05/11] USB: OHCI: Properly handle ohci-ep93xx suspend Manjunath Goudar
@ 2013-07-22  9:32   ` Manjunath Goudar
  2013-07-22  9:32   ` [PATCH 07/11] USB: OHCI: Properly handle ohci-omap suspend Manjunath Goudar
                     ` (5 subsequent siblings)
  11 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-07-22  9:32 UTC (permalink / raw)
  To: linux-arm-kernel

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>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg KH <greg@kroah.com>
Cc: linux-usb at vger.kernel.org

V2:
 -Incase ohci_suspend() fails, return right away without
  executing further.

V3:
 -rid of unwanted code from ohci_hcd_s3c2410_drv_suspend() which already
  ohci_suspend() does it.
 -Aligned variable "do_wakeup" and "ret".

V4:
 -The do_wakeup and rc variable alignment is removed.
---
 drivers/usb/host/ohci-exynos.c |   20 +++++---------------
 1 file changed, 5 insertions(+), 15 deletions(-)

diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c
index ae6068d..17de3dd 100644
--- a/drivers/usb/host/ohci-exynos.c
+++ b/drivers/usb/host/ohci-exynos.c
@@ -203,24 +203,15 @@ 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;
 
-	/*
-	 * Root hub was already suspended. Disable irq emission and
-	 * mark HW unaccessible, bail out if RH has been resumed. Use
-	 * the spinlock to properly synchronize with possible pending
-	 * RH suspend or resume activity.
-	 */
-	spin_lock_irqsave(&ohci->lock, flags);
-	if (ohci->rh_state != OHCI_RH_SUSPENDED &&
-			ohci->rh_state != OHCI_RH_HALTED) {
-		rc = -EINVAL;
-		goto fail;
-	}
-
-	clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
+	rc = ohci_suspend(hcd, do_wakeup);
+	if (rc)
+		return rc;
 
+	spin_lock_irqsave(&ohci->lock, flags);
 	if (exynos_ohci->otg)
 		exynos_ohci->otg->set_host(exynos_ohci->otg, &hcd->self);
 
@@ -228,7 +219,6 @@ static int exynos_ohci_suspend(struct device *dev)
 
 	clk_disable_unprepare(exynos_ohci->clk);
 
-fail:
 	spin_unlock_irqrestore(&ohci->lock, flags);
 
 	return rc;
-- 
1.7.9.5

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

* [PATCH 07/11] USB: OHCI: Properly handle ohci-omap suspend
  2013-07-22  9:32 ` [PATCH 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                     ` (5 preceding siblings ...)
  2013-07-22  9:32   ` [PATCH 06/11] USB: OHCI: Properly handle ohci-exynos suspend Manjunath Goudar
@ 2013-07-22  9:32   ` Manjunath Goudar
  2013-07-22  9:32   ` [PATCH 08/11] USB: OHCI: Properly handle ohci-platform suspend Manjunath Goudar
                     ` (4 subsequent siblings)
  11 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-07-22  9:32 UTC (permalink / raw)
  To: linux-arm-kernel

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>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg KH <greg@kroah.com>
Cc: linux-usb at vger.kernel.org

V2:
 -Incase ohci_suspend() fails, return right away without
  executing further.

V3:
 -Aligned variable "do_wakeup" and "ret".

V4:
 -The do_wakeup and ret variable alignment is removed.
---
 drivers/usb/host/ohci-omap.c |   13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c
index 8149ef0..d13fb4f 100644
--- a/drivers/usb/host/ohci-omap.c
+++ b/drivers/usb/host/ohci-omap.c
@@ -431,16 +431,23 @@ 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);
+	if (ret)
+		return ret;
+
 	omap_ohci_clock_power(0);
-	return 0;
+	return ret;
 }
 
 static int ohci_omap_resume(struct platform_device *dev)
-- 
1.7.9.5

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

* [PATCH 08/11] USB: OHCI: Properly handle ohci-platform suspend
  2013-07-22  9:32 ` [PATCH 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                     ` (6 preceding siblings ...)
  2013-07-22  9:32   ` [PATCH 07/11] USB: OHCI: Properly handle ohci-omap suspend Manjunath Goudar
@ 2013-07-22  9:32   ` Manjunath Goudar
  2013-07-22  9:32   ` [PATCH 09/11] USB: OHCI: Properly handle ohci-pxa27x suspend Manjunath Goudar
                     ` (3 subsequent siblings)
  11 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-07-22  9:32 UTC (permalink / raw)
  To: linux-arm-kernel

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>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg KH <greg@kroah.com>
Cc: linux-usb at vger.kernel.org

V2:
 -Incase ohci_suspend() fails, return right away without
  executing further.

V3:
 -Aligned variable "do_wakeup" and "ret".

V4:
 -The do_wakeup and ret variable alignment is removed.
---
 drivers/usb/host/ohci-platform.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c
index bc30475..b4a8784 100644
--- a/drivers/usb/host/ohci-platform.c
+++ b/drivers/usb/host/ohci-platform.c
@@ -139,14 +139,21 @@ 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)
+		return ret;
 
 	if (pdata->power_suspend)
 		pdata->power_suspend(pdev);
 
-	return 0;
+	return ret;
 }
 
 static int ohci_platform_resume(struct device *dev)
-- 
1.7.9.5

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

* [PATCH 09/11] USB: OHCI: Properly handle ohci-pxa27x suspend
  2013-07-22  9:32 ` [PATCH 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                     ` (7 preceding siblings ...)
  2013-07-22  9:32   ` [PATCH 08/11] USB: OHCI: Properly handle ohci-platform suspend Manjunath Goudar
@ 2013-07-22  9:32   ` Manjunath Goudar
  2013-07-22  9:32   ` [PATCH 10/11] USB: OHCI: Properly handle ohci-sm501 suspend Manjunath Goudar
                     ` (2 subsequent siblings)
  11 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-07-22  9:32 UTC (permalink / raw)
  To: linux-arm-kernel

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>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg KH <greg@kroah.com>
Cc: linux-usb at vger.kernel.org

V2:
 -Incase ohci_suspend() fails, return right away without
  executing further.
V3:
 -Aligned variable "do_wakeup" and "ret".

V4:
 -The do_wakeup and ret variable alignment is removed.
---
 drivers/usb/host/ohci-pxa27x.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c
index 3a9c01d..5fb91f1 100644
--- a/drivers/usb/host/ohci-pxa27x.c
+++ b/drivers/usb/host/ohci-pxa27x.c
@@ -564,13 +564,19 @@ 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);
+	if (ret)
+		return ret;
+
 	pxa27x_stop_hc(ohci, dev);
-	return 0;
+	return ret;
 }
 
 static int ohci_hcd_pxa27x_drv_resume(struct device *dev)
-- 
1.7.9.5

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

* [PATCH 10/11] USB: OHCI: Properly handle ohci-sm501 suspend
  2013-07-22  9:32 ` [PATCH 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                     ` (8 preceding siblings ...)
  2013-07-22  9:32   ` [PATCH 09/11] USB: OHCI: Properly handle ohci-pxa27x suspend Manjunath Goudar
@ 2013-07-22  9:32   ` Manjunath Goudar
  2013-07-22  9:32   ` [PATCH 11/11] USB: OHCI: Properly handle ohci-spear suspend Manjunath Goudar
  2013-07-22  9:51   ` [PATCH V4 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue manjunath
  11 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-07-22  9:32 UTC (permalink / raw)
  To: linux-arm-kernel

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>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg KH <greg@kroah.com>
Cc: linux-usb at vger.kernel.org

V2:
 -Incase ohci_suspend() fails, return right away without
  executing further.
V3:
 -Aligned variable "do_wakeup" and "ret".

-V4:
 -The do_wakeup and ret variable alignment is removed.
---
 drivers/usb/host/ohci-sm501.c |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/ohci-sm501.c b/drivers/usb/host/ohci-sm501.c
index d479d5d..2a5de5f 100644
--- a/drivers/usb/host/ohci-sm501.c
+++ b/drivers/usb/host/ohci-sm501.c
@@ -216,14 +216,21 @@ 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);
+	if (ret)
+		return ret;
+
 	sm501_unit_power(dev->parent, SM501_GATE_USB_HOST, 0);
-	return 0;
+	return ret;
 }
 
 static int ohci_sm501_resume(struct platform_device *pdev)
-- 
1.7.9.5

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

* [PATCH 11/11] USB: OHCI: Properly handle ohci-spear suspend
  2013-07-22  9:32 ` [PATCH 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                     ` (9 preceding siblings ...)
  2013-07-22  9:32   ` [PATCH 10/11] USB: OHCI: Properly handle ohci-sm501 suspend Manjunath Goudar
@ 2013-07-22  9:32   ` Manjunath Goudar
  2013-07-22  9:51   ` [PATCH V4 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue manjunath
  11 siblings, 0 replies; 107+ messages in thread
From: Manjunath Goudar @ 2013-07-22  9:32 UTC (permalink / raw)
  To: linux-arm-kernel

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>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg KH <greg@kroah.com>
Cc: linux-usb at vger.kernel.org

V2:
 -Incase ohci_suspend() fails, return right away without
  executing further.
V3:
 -Aligned variable "do_wakeup" and "ret".

V4:
 -The do_wakeup and ret variable alignment is removed.
---
 drivers/usb/host/ohci-spear.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/host/ohci-spear.c b/drivers/usb/host/ohci-spear.c
index 31ff3fc..41148f8 100644
--- a/drivers/usb/host/ohci-spear.c
+++ b/drivers/usb/host/ohci-spear.c
@@ -130,20 +130,26 @@ 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);
+	if (ret)
+		return ret;
+
 	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

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

* [PATCH V4 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue
  2013-07-22  9:32 ` [PATCH 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
                     ` (10 preceding siblings ...)
  2013-07-22  9:32   ` [PATCH 11/11] USB: OHCI: Properly handle ohci-spear suspend Manjunath Goudar
@ 2013-07-22  9:51   ` manjunath
  2013-07-23 23:06     ` Greg KH
  11 siblings, 1 reply; 107+ messages in thread
From: manjunath @ 2013-07-22  9:51 UTC (permalink / raw)
  To: linux-arm-kernel

On Monday 22 July 2013 03:02 PM, Manjunath Goudar 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.
>
> V3:
>   -New patch 1/11 added, for generic ohci-hcd suspend code.
>
> V4:
>   -Properly aligned "do_wakeup" and "ret" variables.
>
> Manjunath Goudar (11):
>    USB: OHCI: Properly handle OHCI controller suspend
>    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     |   10 ++++++++--
>   drivers/usb/host/ohci-da8xx.c    |   15 +++++++++++----
>   drivers/usb/host/ohci-ep93xx.c   |    9 ++++++++-
>   drivers/usb/host/ohci-exynos.c   |   20 +++++---------------
>   drivers/usb/host/ohci-hcd.c      |    9 ++++++++-
>   drivers/usb/host/ohci-omap.c     |   13 ++++++++++---
>   drivers/usb/host/ohci-platform.c |    9 ++++++++-
>   drivers/usb/host/ohci-pxa27x.c   |    8 +++++++-
>   drivers/usb/host/ohci-s3c2410.c  |   19 ++++---------------
>   drivers/usb/host/ohci-sm501.c    |   11 +++++++++--
>   drivers/usb/host/ohci-spear.c    |   12 +++++++++---
>   11 files changed, 87 insertions(+), 48 deletions(-)
>
I am sorry, not updated patch subject line. This is patch V4 series.

Thanks
Manjunath Goudar

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

* [PATCH 04/11] USB: OHCI: Properly handle ohci-da8xx suspend
  2013-07-22  9:32   ` [PATCH 04/11] USB: OHCI: Properly handle ohci-da8xx suspend Manjunath Goudar
@ 2013-07-22 12:18     ` Sergei Shtylyov
  0 siblings, 0 replies; 107+ messages in thread
From: Sergei Shtylyov @ 2013-07-22 12:18 UTC (permalink / raw)
  To: linux-arm-kernel

Hello.

On 22-07-2013 13:32, 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>
> Acked-by: Alan Stern <stern@rowland.harvard.edu>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Greg KH <greg@kroah.com>
> Cc: linux-usb at vger.kernel.org

> V2:
>   -Incase ohci_suspend() fails, return right away without
>    executing further.

> V3:
>   -Aligned variable "do_wakeup" and "ret".
>   -pdev->dev.power.power_state stuff has been removed.

> V4:
>   -Properly aligned "do_wakeup" and "ret" variable.
> ---
>   drivers/usb/host/ohci-da8xx.c |   15 +++++++++++----
>   1 file changed, 11 insertions(+), 4 deletions(-)

> diff --git a/drivers/usb/host/ohci-da8xx.c b/drivers/usb/host/ohci-da8xx.c
> index 6aaa9c9..c649a35 100644
> --- a/drivers/usb/host/ohci-da8xx.c
> +++ b/drivers/usb/host/ohci-da8xx.c
> @@ -406,19 +406,26 @@ 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)

    Please start this line under *struct* above. Don't break the coding style 
we used in this file.

WBR, Sergei

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

* [PATCH V4 00/11]  USB: OHCI:Properly handle ohci_suspend()routine in bus glue
  2013-07-22  9:51   ` [PATCH V4 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue manjunath
@ 2013-07-23 23:06     ` Greg KH
  0 siblings, 0 replies; 107+ messages in thread
From: Greg KH @ 2013-07-23 23:06 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Jul 22, 2013 at 03:21:31PM +0530, manjunath wrote:
> On Monday 22 July 2013 03:02 PM, Manjunath Goudar 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.
> >
> >V3:
> >  -New patch 1/11 added, for generic ohci-hcd suspend code.
> >
> >V4:
> >  -Properly aligned "do_wakeup" and "ret" variables.
> >
> >Manjunath Goudar (11):
> >   USB: OHCI: Properly handle OHCI controller suspend
> >   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     |   10 ++++++++--
> >  drivers/usb/host/ohci-da8xx.c    |   15 +++++++++++----
> >  drivers/usb/host/ohci-ep93xx.c   |    9 ++++++++-
> >  drivers/usb/host/ohci-exynos.c   |   20 +++++---------------
> >  drivers/usb/host/ohci-hcd.c      |    9 ++++++++-
> >  drivers/usb/host/ohci-omap.c     |   13 ++++++++++---
> >  drivers/usb/host/ohci-platform.c |    9 ++++++++-
> >  drivers/usb/host/ohci-pxa27x.c   |    8 +++++++-
> >  drivers/usb/host/ohci-s3c2410.c  |   19 ++++---------------
> >  drivers/usb/host/ohci-sm501.c    |   11 +++++++++--
> >  drivers/usb/host/ohci-spear.c    |   12 +++++++++---
> >  11 files changed, 87 insertions(+), 48 deletions(-)
> >
> I am sorry, not updated patch subject line. This is patch V4 series.

I'm totally confused by all of the different series of patches you've
sent out, and I don't see Arnd's acks on any of them, so I'll just purge
them all from my queue and wait for the next round.

Also, after what happened last time, I require Arnd to sign-off on all
of these types of patches, if for no other reason than I want someone I
know to be around when they break things :)

thanks,

greg k-h

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

end of thread, other threads:[~2013-07-23 23:06 UTC | newest]

Thread overview: 107+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-12 15:28 [PATCH 00/10] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
2013-06-12 15:28 ` [PATCH 01/10] USB: OHCI: Properly handle ohci-at91 suspend Manjunath Goudar
2013-06-12 16:04   ` Alan Stern
2013-06-12 16:25     ` Alan Stern
2013-06-12 15:28 ` [PATCH 02/10] USB: OHCI: Properly handle ohci-s3c2410 suspend Manjunath Goudar
2013-06-12 15:58   ` Sergei Shtylyov
2013-06-12 15:28 ` [PATCH 03/10] USB: OHCI: Properly handle ohci-da8xx suspend Manjunath Goudar
2013-06-12 15:54   ` Sergei Shtylyov
2013-06-12 15:28 ` [PATCH 04/10] USB: OHCI: Properly handle ohci-ep93xx suspend Manjunath Goudar
2013-06-12 15:28 ` [PATCH 05/10] USB: OHCI: Properly handle ohci-exynos suspend Manjunath Goudar
2013-06-12 15:28 ` [PATCH 06/10] USB: OHCI: Properly handle ohci-omap suspend Manjunath Goudar
2013-06-12 15:28 ` [PATCH 07/10] USB: OHCI: Properly handle ohci-platform suspend Manjunath Goudar
2013-06-12 15:28 ` [PATCH 08/10] USB: OHCI: Properly handle ohci-pxa27x suspend Manjunath Goudar
2013-06-12 15:28 ` [PATCH 09/10] USB: OHCI: Properly handle ohci-sm501 suspend Manjunath Goudar
2013-06-12 15:28 ` [PATCH 10/10] USB: OHCI: Properly handle ohci-spear suspend Manjunath Goudar
2013-06-13  9:10 ` [PATCH 00/10] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
2013-06-13  9:10   ` [PATCH 01/10] USB: OHCI: Properly handle ohci-at91 suspend Manjunath Goudar
2013-06-13  9:10   ` [PATCH 02/10] USB: OHCI: Properly handle ohci-s3c2410 suspend Manjunath Goudar
2013-06-13  9:10   ` [PATCH 03/10] USB: OHCI: Properly handle ohci-da8xx suspend Manjunath Goudar
2013-06-13  9:10   ` [PATCH 04/10] USB: OHCI: Properly handle ohci-ep93xx suspend Manjunath Goudar
2013-06-13  9:10   ` [PATCH 05/10] USB: OHCI: Properly handle ohci-exynos suspend Manjunath Goudar
2013-06-13  9:10   ` [PATCH 06/10] USB: OHCI: Properly handle ohci-omap suspend Manjunath Goudar
2013-06-13  9:10   ` [PATCH 07/10] USB: OHCI: Properly handle ohci-platform suspend Manjunath Goudar
2013-06-13  9:10   ` [PATCH 08/10] USB: OHCI: Properly handle ohci-pxa27x suspend Manjunath Goudar
2013-06-13  9:11   ` [PATCH 09/10] USB: OHCI: Properly handle ohci-sm501 suspend Manjunath Goudar
2013-06-13  9:11   ` [PATCH 10/10] USB: OHCI: Properly handle ohci-spear suspend Manjunath Goudar
2013-06-13  9:19     ` Viresh Kumar
2013-06-13 14:33       ` Alan Stern
2013-06-13  9:16 ` [PATCH V2 00/10] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
2013-06-13  9:16   ` [PATCH V2 01/10] USB: OHCI: Properly handle ohci-at91 suspend Manjunath Goudar
2013-06-13 19:14     ` Alan Stern
     [not found]       ` <CAJFYCKG8i=33zXS-dhVJopaTVhCKJ_DCKo+q9wyx7CVzqzfn5g@mail.gmail.com>
2013-06-17  9:25         ` Viresh Kumar
2013-06-13  9:16   ` [PATCH V2 02/10] USB: OHCI: Properly handle ohci-s3c2410 suspend Manjunath Goudar
2013-06-13 19:20     ` Alan Stern
2013-06-13  9:16   ` [PATCH V2 03/10] USB: OHCI: Properly handle ohci-da8xx suspend Manjunath Goudar
2013-06-13 19:26     ` Alan Stern
2013-06-13  9:16   ` [PATCH V2 04/10] USB: OHCI: Properly handle ohci-ep93xx suspend Manjunath Goudar
2013-06-13  9:16   ` [PATCH V2 05/10] USB: OHCI: Properly handle ohci-exynos suspend Manjunath Goudar
2013-06-13 19:29     ` Tomasz Figa
2013-06-13 19:52       ` Alan Stern
     [not found]         ` <CAJFYCKFHhD2LuPP5LKSXzg4zuCMmNTSWRRUQkwFcQVmXSaLo9Q@mail.gmail.com>
2013-06-18 10:02           ` Sachin Kamat
2013-06-18 15:06           ` Alan Stern
2013-06-13  9:16   ` [PATCH V2 06/10] USB: OHCI: Properly handle ohci-omap suspend Manjunath Goudar
2013-06-13  9:16   ` [PATCH V2 07/10] USB: OHCI: Properly handle ohci-platform suspend Manjunath Goudar
2013-06-13  9:16   ` [PATCH V2 08/10] USB: OHCI: Properly handle ohci-pxa27x suspend Manjunath Goudar
2013-06-13  9:16   ` [PATCH V2 09/10] USB: OHCI: Properly handle ohci-sm501 suspend Manjunath Goudar
2013-06-13  9:16   ` [PATCH V2 10/10] USB: OHCI: Properly handle ohci-spear suspend Manjunath Goudar
2013-06-19 12:12 ` [PATCH V3 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
2013-06-19 12:12   ` [PATCH V3 01/11] USB: OHCI: Properly handle OHCI controller suspend Manjunath Goudar
2013-06-19 12:12   ` [PATCH V3 02/11] USB: OHCI: Properly handle ohci-at91 suspend Manjunath Goudar
2013-06-19 12:12   ` [PATCH V3 03/11] USB: OHCI: Properly handle ohci-s3c2410 suspend Manjunath Goudar
2013-06-19 12:12   ` [PATCH V3 04/11] USB: OHCI: Properly handle ohci-da8xx suspend Manjunath Goudar
2013-06-19 12:12   ` [PATCH V3 05/11] USB: OHCI: Properly handle ohci-ep93xx suspend Manjunath Goudar
2013-06-19 12:43     ` Sergei Shtylyov
     [not found]       ` <CAJFYCKGck29t211NTmXSKPtFdah3Pbe8T0UVZDsqWqqax3OL7g@mail.gmail.com>
2013-06-19 14:49         ` Viresh Kumar
2013-06-19 17:33         ` Sergei Shtylyov
2013-06-19 12:12   ` [PATCH V3 06/11] USB: OHCI: Properly handle ohci-exynos suspend Manjunath Goudar
2013-06-19 12:47     ` Sergei Shtylyov
2013-06-19 12:12   ` [PATCH V3 07/11] USB: OHCI: Properly handle ohci-omap suspend Manjunath Goudar
2013-06-19 12:12   ` [PATCH V3 08/11] USB: OHCI: Properly handle ohci-platform suspend Manjunath Goudar
2013-06-19 12:49     ` Sergei Shtylyov
2013-06-19 12:12   ` [PATCH V3 09/11] USB: OHCI: Properly handle ohci-pxa27x suspend Manjunath Goudar
2013-06-19 12:50     ` Sergei Shtylyov
2013-06-19 12:12   ` [PATCH V3 10/11] USB: OHCI: Properly handle ohci-sm501 suspend Manjunath Goudar
2013-06-19 12:12   ` [PATCH V3 11/11] USB: OHCI: Properly handle ohci-spear suspend Manjunath Goudar
2013-06-19 12:53     ` Sergei Shtylyov
2013-06-20  9:35 ` [PATCH V4 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
2013-06-20  9:35   ` [PATCH V4 01/11] USB: OHCI: Properly handle OHCI controller suspend Manjunath Goudar
2013-06-20  9:35   ` [PATCH V4 02/11] USB: OHCI: Properly handle ohci-at91 suspend Manjunath Goudar
2013-06-20  9:35   ` [PATCH V4 03/11] USB: OHCI: Properly handle ohci-s3c2410 suspend Manjunath Goudar
2013-06-20  9:36   ` [PATCH V4 04/11] USB: OHCI: Properly handle ohci-da8xx suspend Manjunath Goudar
2013-06-20 11:31     ` Sergei Shtylyov
2013-06-20  9:36   ` [PATCH V4 05/11] USB: OHCI: Properly handle ohci-ep93xx suspend Manjunath Goudar
2013-06-20  9:36   ` [PATCH V4 06/11] USB: OHCI: Properly handle ohci-exynos suspend Manjunath Goudar
2013-06-20  9:36   ` [PATCH V4 07/11] USB: OHCI: Properly handle ohci-omap suspend Manjunath Goudar
2013-06-20  9:36   ` [PATCH V4 08/11] USB: OHCI: Properly handle ohci-platform suspend Manjunath Goudar
2013-06-20  9:36   ` [PATCH V4 09/11] USB: OHCI: Properly handle ohci-pxa27x suspend Manjunath Goudar
2013-06-20  9:36   ` [PATCH V4 10/11] USB: OHCI: Properly handle ohci-sm501 suspend Manjunath Goudar
2013-06-20  9:36   ` [PATCH V4 11/11] USB: OHCI: Properly handle ohci-spear suspend Manjunath Goudar
2013-06-20 19:50   ` [PATCH V4 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Alan Stern
2013-06-25  6:39 ` Manjunath Goudar
2013-06-25  6:39   ` [PATCH V4 01/11] USB: OHCI: Properly handle OHCI controller suspend Manjunath Goudar
2013-06-25  6:39   ` [PATCH V4 02/11] USB: OHCI: Properly handle ohci-at91 suspend Manjunath Goudar
2013-06-25  6:39   ` [PATCH V4 03/11] USB: OHCI: Properly handle ohci-s3c2410 suspend Manjunath Goudar
2013-06-25  6:39   ` [PATCH V4 04/11] USB: OHCI: Properly handle ohci-da8xx suspend Manjunath Goudar
2013-06-25  6:39   ` [PATCH V4 05/11] USB: OHCI: Properly handle ohci-ep93xx suspend Manjunath Goudar
2013-06-25  6:39   ` [PATCH V4 06/11] USB: OHCI: Properly handle ohci-exynos suspend Manjunath Goudar
2013-06-25  6:39   ` [PATCH V4 07/11] USB: OHCI: Properly handle ohci-omap suspend Manjunath Goudar
2013-06-25  6:39   ` [PATCH V4 08/11] USB: OHCI: Properly handle ohci-platform suspend Manjunath Goudar
2013-06-25  6:39   ` [PATCH V4 09/11] USB: OHCI: Properly handle ohci-pxa27x suspend Manjunath Goudar
2013-06-25  6:39   ` [PATCH V4 10/11] USB: OHCI: Properly handle ohci-sm501 suspend Manjunath Goudar
2013-06-25  6:39   ` [PATCH V4 11/11] USB: OHCI: Properly handle ohci-spear suspend Manjunath Goudar
2013-07-22  9:32 ` [PATCH 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue Manjunath Goudar
2013-07-22  9:32   ` [PATCH 01/11] USB: OHCI: Properly handle OHCI controller suspend Manjunath Goudar
2013-07-22  9:32   ` [PATCH 02/11] USB: OHCI: Properly handle ohci-at91 suspend Manjunath Goudar
2013-07-22  9:32   ` [PATCH 03/11] USB: OHCI: Properly handle ohci-s3c2410 suspend Manjunath Goudar
2013-07-22  9:32   ` [PATCH 04/11] USB: OHCI: Properly handle ohci-da8xx suspend Manjunath Goudar
2013-07-22 12:18     ` Sergei Shtylyov
2013-07-22  9:32   ` [PATCH 05/11] USB: OHCI: Properly handle ohci-ep93xx suspend Manjunath Goudar
2013-07-22  9:32   ` [PATCH 06/11] USB: OHCI: Properly handle ohci-exynos suspend Manjunath Goudar
2013-07-22  9:32   ` [PATCH 07/11] USB: OHCI: Properly handle ohci-omap suspend Manjunath Goudar
2013-07-22  9:32   ` [PATCH 08/11] USB: OHCI: Properly handle ohci-platform suspend Manjunath Goudar
2013-07-22  9:32   ` [PATCH 09/11] USB: OHCI: Properly handle ohci-pxa27x suspend Manjunath Goudar
2013-07-22  9:32   ` [PATCH 10/11] USB: OHCI: Properly handle ohci-sm501 suspend Manjunath Goudar
2013-07-22  9:32   ` [PATCH 11/11] USB: OHCI: Properly handle ohci-spear suspend Manjunath Goudar
2013-07-22  9:51   ` [PATCH V4 00/11] USB: OHCI:Properly handle ohci_suspend()routine in bus glue manjunath
2013-07-23 23:06     ` Greg KH

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.