Skip to contentSkip to conversation

USB: OHCI:Properly handle ohci_suspend()routine in bus glue

PATCH New Manjunath Goudar 7 participants 107 messages Jun 12, 2013 – Jul 23, 2013 3 messages not in the archive

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

cover USB: OHCI:Properly handle ohci_suspend()routine in bus glue

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(-)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/10 USB: OHCI: Properly handle ohci-at91 suspend

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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-at91.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/usb/host/ohci-at91.c +6 -2
index fb2f127..28400a7 100644
@@ -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)
Signature · 1 line
1.7.9.5
maintainer
#2 lore raw

PATCH 1/10 USB: OHCI: Properly handle ohci-at91 suspend

Quoted 24 lines · Manjunath Goudar

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.

drivers/usb/host/ohci-at91.c +5 -1
index fb2f127..28400a7 100644
@@ -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);
 
 	/*

drivers/usb/host/ohci-at91.c ohci_hcd_at91_drv_suspend(struct platform_device *pdev, pm_message_t mesg) · line 644

Quoted 5 lines
drivers/usb/host/ohci-at91.c +1 -1
@@ -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

maintainer
#3 lore raw

PATCH 1/10 USB: OHCI: Properly handle ohci-at91 suspend

Quoted 29 lines · Alan Stern
Quoted 27 lines · Manjunath Goudar

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.

drivers/usb/host/ohci-at91.c +5 -1
index fb2f127..28400a7 100644
@@ -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();
 	}
 
Quoted 5 lines

drivers/usb/host/ohci-at91.c ohci_hcd_at91_drv_suspend(struct platform_device *pdev, pm_message_t mesg) · line 644

Quoted 2 lines
drivers/usb/host/ohci-at91.c +1 -1
-	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:

drivers/usb/host/ohci-at91.c +12 -2
Index: 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

#4 lore raw

PATCH 2/10 USB: OHCI: Properly handle ohci-s3c2410 suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-s3c2410.c |    3 +++
 1 file changed, 3 insertions(+)
drivers/usb/host/ohci-s3c2410.c +3 -0
index 8018bb1..2ffa693 100644
@@ -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);
Signature · 1 line
1.7.9.5
#5 lore raw

PATCH 2/10 USB: OHCI: Properly handle ohci-s3c2410 suspend

Hello.

Quoted 28 lines · Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
  drivers/usb/host/ohci-s3c2410.c |    3 +++
  1 file changed, 3 insertions(+)
drivers/usb/host/ohci-s3c2410.c +1 -0
index 8018bb1..2ffa693 100644
@@ -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

drivers/usb/host/ohci-s3c2410.c static int ohci_hcd_s3c2410_drv_suspend(struct device *dev) · line 450

Quoted 5 lines
drivers/usb/host/ohci-s3c2410.c +2 -0
@@ -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

#6 lore raw

PATCH 3/10 USB: OHCI: Properly handle ohci-da8xx suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-da8xx.c |   13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/usb/host/ohci-da8xx.c +9 -4
index 6aaa9c9..3b1d9bd 100644
@@ -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)
Signature · 1 line
1.7.9.5
#7 lore raw

PATCH 3/10 USB: OHCI: Properly handle ohci-da8xx suspend

Hello.

Quoted 21 lines · Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
  drivers/usb/host/ohci-da8xx.c |   13 +++++++++----
  1 file changed, 9 insertions(+), 4 deletions(-)
drivers/usb/host/ohci-da8xx.c +0 -0
index 6aaa9c9..3b1d9bd 100644
@@ -406,19 +406,24 @@ static int ohci_hcd_da8xx_drv_remove(struct platform_device *dev)
  }

drivers/usb/host/ohci-da8xx.c static int ohci_hcd_da8xx_drv_remove(struct platform_device *dev) · line 414

Quoted 10 lines
drivers/usb/host/ohci-da8xx.c +4 -2
 
  #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?

drivers/usb/host/ohci-da8xx.c static int ohci_hcd_da8xx_drv_remove(struct platform_device *dev) · line 416

Quoted 2 lines
drivers/usb/host/ohci-da8xx.c +1 -0
+	int ret;
 

WBR, Sergei

#8 lore raw

PATCH 4/10 USB: OHCI: Properly handle ohci-ep93xx suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-ep93xx.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/usb/host/ohci-ep93xx.c +5 -1
index 8704e9f..7c77f61 100644
@@ -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)
Signature · 1 line
1.7.9.5
#9 lore raw

PATCH 5/10 USB: OHCI: Properly handle ohci-exynos suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-exynos.c |    3 +++
 1 file changed, 3 insertions(+)
drivers/usb/host/ohci-exynos.c +3 -0
index 6ff830c..6ad38ee 100644
@@ -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:
Signature · 1 line
1.7.9.5
#10 lore raw

PATCH 6/10 USB: OHCI: Properly handle ohci-omap suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-omap.c |   11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/usb/host/ohci-omap.c +8 -3
index b900dba..a638a14 100644
@@ -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)
Signature · 1 line
1.7.9.5
#11 lore raw

PATCH 7/10 USB: OHCI: Properly handle ohci-platform suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-platform.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/usb/host/ohci-platform.c +5 -1
index bc30475..ad8cb3b 100644
@@ -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)
Signature · 1 line
1.7.9.5
#12 lore raw

PATCH 8/10 USB: OHCI: Properly handle ohci-pxa27x suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-pxa27x.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/usb/host/ohci-pxa27x.c +5 -1
index 3a9c01d..9dbfeb8 100644
@@ -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)
Signature · 1 line
1.7.9.5
#13 lore raw

PATCH 9/10 USB: OHCI: Properly handle ohci-sm501 suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-sm501.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/usb/host/ohci-sm501.c +7 -2
index d479d5d..f4f2da0 100644
@@ -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)
Signature · 1 line
1.7.9.5
#14 lore raw

PATCH 10/10 USB: OHCI: Properly handle ohci-spear suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-spear.c |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/usb/host/ohci-spear.c +7 -3
index 31ff3fc..5a843f0 100644
@@ -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)
Signature · 1 line
1.7.9.5
#15 lore raw

cover USB: OHCI:Properly handle ohci_suspend()routine in bus glue

In reply to Manjunath Goudar

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(-)
Signature · 1 line
1.7.9.5
#16 lore raw

PATCH 1/10 USB: OHCI: Properly handle ohci-at91 suspend

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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-at91.c |   14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/usb/host/ohci-at91.c +12 -2
index fb2f127..6620e3a 100644
@@ -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)
Signature · 1 line
1.7.9.5
#17 lore raw

PATCH 2/10 USB: OHCI: Properly handle ohci-s3c2410 suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-s3c2410.c |    8 ++++++++
 1 file changed, 8 insertions(+)
drivers/usb/host/ohci-s3c2410.c +8 -0
index 8018bb1..01430f2 100644
@@ -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
Signature · 1 line
1.7.9.5
#18 lore raw

PATCH 3/10 USB: OHCI: Properly handle ohci-da8xx suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-da8xx.c |   19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)
drivers/usb/host/ohci-da8xx.c +15 -4
index 6aaa9c9..8d4914d 100644
@@ -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)
Signature · 1 line
1.7.9.5
#19 lore raw

PATCH 4/10 USB: OHCI: Properly handle ohci-ep93xx suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-ep93xx.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/usb/host/ohci-ep93xx.c +11 -1
index 8704e9f..b36b74e 100644
@@ -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)
Signature · 1 line
1.7.9.5
#20 lore raw

PATCH 5/10 USB: OHCI: Properly handle ohci-exynos suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-exynos.c |    8 ++++++++
 1 file changed, 8 insertions(+)
drivers/usb/host/ohci-exynos.c +8 -0
index 6ff830c..8fecb6a 100644
@@ -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
Signature · 1 line
1.7.9.5
#21 lore raw

PATCH 6/10 USB: OHCI: Properly handle ohci-omap suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-omap.c |   17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
drivers/usb/host/ohci-omap.c +14 -3
index b900dba..9144315 100644
@@ -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)
Signature · 1 line
1.7.9.5
#22 lore raw

PATCH 7/10 USB: OHCI: Properly handle ohci-platform suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-platform.c |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/usb/host/ohci-platform.c +12 -1
index bc30475..f91201b 100644
@@ -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)
Signature · 1 line
1.7.9.5
#23 lore raw

PATCH 8/10 USB: OHCI: Properly handle ohci-pxa27x suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-pxa27x.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/usb/host/ohci-pxa27x.c +11 -1
index 3a9c01d..d441a87 100644
@@ -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)
Signature · 1 line
1.7.9.5
#24 lore raw

PATCH 9/10 USB: OHCI: Properly handle ohci-sm501 suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-sm501.c |   15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/usb/host/ohci-sm501.c +13 -2
index d479d5d..81ebbce 100644
@@ -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)
Signature · 1 line
1.7.9.5
#25 lore raw

PATCH 10/10 USB: OHCI: Properly handle ohci-spear suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-spear.c |   16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/usb/host/ohci-spear.c +13 -3
index 31ff3fc..2ff867b 100644
@@ -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)
Signature · 1 line
1.7.9.5
#26 lore raw

PATCH 10/10 USB: OHCI: Properly handle ohci-spear suspend

Quoted 3 lines · Manjunath Goudar

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.

Quoted 6 lines

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.

Quoted 6 lines
Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org

---

Add it here.

Quoted 14 lines
 drivers/usb/host/ohci-spear.c |   16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/usb/host/ohci-spear.c +1 -1
index 31ff3fc..2ff867b 100644
@@ -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)

drivers/usb/host/ohci-spear.c static int spear_ohci_hcd_drv_remove(struct platform_device *pdev) · line 143

Quoted 10 lines
drivers/usb/host/ohci-spear.c +6 -1
 {
-       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.

Quoted 25 lines
drivers/usb/host/ohci-spear.c +6 -2
+               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

maintainer
#27 lore raw

PATCH 10/10 USB: OHCI: Properly handle ohci-spear suspend

Quoted 7 lines · Viresh Kumar

drivers/usb/host/ohci-spear.c static int spear_ohci_hcd_drv_remove(struct platform_device *pdev) · line 143

Quoted 5 lines
drivers/usb/host/ohci-spear.c +5 -0
+       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.

Quoted 5 lines

I thought ret == 0 is the success case and not error case.

Quoted 3 lines
drivers/usb/host/ohci-spear.c +3 -0
+               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

#28 lore raw

v2 cover USB: OHCI:Properly handle ohci_suspend()routine in bus glue

In reply to Manjunath Goudar

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(-)
Signature · 1 line
1.7.9.5
#29 lore raw

PATCH v2 1/10 USB: OHCI: Properly handle ohci-at91 suspend

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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-at91.c |   14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/usb/host/ohci-at91.c +12 -2
index fb2f127..6620e3a 100644
@@ -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)
Signature · 1 line
1.7.9.5
maintainer
#30 lore raw

PATCH v2 1/10 USB: OHCI: Properly handle ohci-at91 suspend

Quoted 13 lines · Manjunath Goudar

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.

drivers/usb/host/ohci-at91.c +0 -0
index fb2f127..6620e3a 100644

drivers/usb/host/ohci-at91.c ohci_hcd_at91_drv_suspend(struct platform_device *pdev, pm_message_t mesg) · line 623

Quoted 5 lines
drivers/usb/host/ohci-at91.c +2 -0
@@ -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.

A message that is not in the archive (sent off-list or not yet received): CAJFYCKG8i=33zXS-dhVJopaTVhCKJ_DCKo+q9wyx7CVzqzfn5g@mail.gmail.com

#32 lore raw

PATCH v2 1/10 USB: OHCI: Properly handle ohci-at91 suspend

Quoted 7 lines · Manjunath Goudar

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);$

Quoted 5 lines

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.

#33 lore raw

PATCH v2 2/10 USB: OHCI: Properly handle ohci-s3c2410 suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-s3c2410.c |    8 ++++++++
 1 file changed, 8 insertions(+)
drivers/usb/host/ohci-s3c2410.c +8 -0
index 8018bb1..01430f2 100644
@@ -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
Signature · 1 line
1.7.9.5
maintainer
#34 lore raw

PATCH v2 2/10 USB: OHCI: Properly handle ohci-s3c2410 suspend

Quoted 20 lines · Manjunath Goudar

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.

drivers/usb/host/ohci-s3c2410.c +1 -0
index 8018bb1..01430f2 100644
@@ -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);
 

drivers/usb/host/ohci-s3c2410.c static int ohci_hcd_s3c2410_drv_suspend(struct device *dev) · line 444

Quoted 10 lines
drivers/usb/host/ohci-s3c2410.c +7 -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

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

#35 lore raw

PATCH v2 3/10 USB: OHCI: Properly handle ohci-da8xx suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-da8xx.c |   19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)
drivers/usb/host/ohci-da8xx.c +15 -4
index 6aaa9c9..8d4914d 100644
@@ -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)
Signature · 1 line
1.7.9.5
maintainer
#36 lore raw

PATCH v2 3/10 USB: OHCI: Properly handle ohci-da8xx suspend

Quoted 17 lines · Manjunath Goudar

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.

drivers/usb/host/ohci-da8xx.c +0 -0
index 6aaa9c9..8d4914d 100644
@@ -406,10 +406,21 @@ static int ohci_hcd_da8xx_drv_remove(struct platform_device *dev)
 }
 

drivers/usb/host/ohci-da8xx.c static int ohci_hcd_da8xx_drv_remove(struct platform_device *dev) · line 415

Quoted 10 lines
drivers/usb/host/ohci-da8xx.c +5 -2
 #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.

drivers/usb/host/ohci-da8xx.c static int ohci_hcd_da8xx_drv_remove(struct platform_device *dev) · line 426

Quoted 11 lines
drivers/usb/host/ohci-da8xx.c +8 -0
+
+	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.

drivers/usb/host/ohci-da8xx.c static int ohci_da8xx_suspend(struct platform_device *dev, pm_message_t message) · line 433

Quoted 9 lines
drivers/usb/host/ohci-da8xx.c +2 -2
@@ -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

#37 lore raw

PATCH v2 4/10 USB: OHCI: Properly handle ohci-ep93xx suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-ep93xx.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/usb/host/ohci-ep93xx.c +11 -1
index 8704e9f..b36b74e 100644
@@ -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)
Signature · 1 line
1.7.9.5
#38 lore raw

PATCH v2 5/10 USB: OHCI: Properly handle ohci-exynos suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-exynos.c |    8 ++++++++
 1 file changed, 8 insertions(+)
drivers/usb/host/ohci-exynos.c +8 -0
index 6ff830c..8fecb6a 100644
@@ -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
Signature · 1 line
1.7.9.5
#39 lore raw

PATCH v2 5/10 USB: OHCI: Properly handle ohci-exynos suspend

Hi Manjunath,

Quoted 26 lines · 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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-exynos.c |    8 ++++++++
 1 file changed, 8 insertions(+)
(quoted diff) +0 -0

b/drivers/usb/host/ohci-exynos.c index 6ff830c..8fecb6a 100644

drivers/usb/host/ohci-exynos.c +0 -0
@@ -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);

drivers/usb/host/ohci-exynos.c static int exynos_ohci_suspend(struct device *dev) · line 214

Quoted 10 lines
drivers/usb/host/ohci-exynos.c +6 -0
 	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

Quoted 5 lines
drivers/usb/host/ohci-exynos.c +2 -0
+	if (rc)
+		return rc;
 	/*
 	 * Root hub was already suspended. Disable irq emission and
 	 * mark HW unaccessible, bail out if RH has been resumed. Use
maintainer
#40 lore raw

PATCH v2 5/10 USB: OHCI: Properly handle ohci-exynos suspend

Quoted 11 lines · Tomasz Figa

drivers/usb/host/ohci-exynos.c static int exynos_ohci_suspend(struct device *dev) · line 214

Quoted 5 lines
drivers/usb/host/ohci-exynos.c +5 -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.

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

A message that is not in the archive (sent off-list or not yet received): CAJFYCKFHhD2LuPP5LKSXzg4zuCMmNTSWRRUQkwFcQVmXSaLo9Q@mail.gmail.com

#42 lore raw

PATCH v2 5/10 USB: OHCI: Properly handle ohci-exynos suspend

Quoted 35 lines · Manjunath Goudar
Quoted 18 lines · Alan Stern
Quoted 6 lines · Tomasz Figa

drivers/usb/host/ohci-exynos.c static int exynos_ohci_suspend(struct device *dev) · line 214

Quoted 5 lines
drivers/usb/host/ohci-exynos.c +5 -0
+   rc = ohci_suspend(hcd, do_wakeup);
+   if (rc == 0 && do_wakeup && HCD_WAKEUP_PENDING(hcd)) {
+           ohci_resume(hcd, false);
+           rc = -EBUSY;
+   }
Quoted 6 lines

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.

Quoted 8 lines

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.

Quoted 6 lines

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.

Signature · 2 lines
With warm regards,
Sachin
maintainer
#43 lore raw

PATCH v2 5/10 USB: OHCI: Properly handle ohci-exynos suspend

In reply to a message not in the archive
Quoted 7 lines · Manjunath Goudar

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

#44 lore raw

PATCH v2 6/10 USB: OHCI: Properly handle ohci-omap suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-omap.c |   17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
drivers/usb/host/ohci-omap.c +14 -3
index b900dba..9144315 100644
@@ -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)
Signature · 1 line
1.7.9.5
#45 lore raw

PATCH v2 7/10 USB: OHCI: Properly handle ohci-platform suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-platform.c |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/usb/host/ohci-platform.c +12 -1
index bc30475..f91201b 100644
@@ -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)
Signature · 1 line
1.7.9.5
#46 lore raw

PATCH v2 8/10 USB: OHCI: Properly handle ohci-pxa27x suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-pxa27x.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/usb/host/ohci-pxa27x.c +11 -1
index 3a9c01d..d441a87 100644
@@ -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)
Signature · 1 line
1.7.9.5
#47 lore raw

PATCH v2 9/10 USB: OHCI: Properly handle ohci-sm501 suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-sm501.c |   15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/usb/host/ohci-sm501.c +13 -2
index d479d5d..81ebbce 100644
@@ -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)
Signature · 1 line
1.7.9.5
#48 lore raw

PATCH v2 10/10 USB: OHCI: Properly handle ohci-spear suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ohci-spear.c |   16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/usb/host/ohci-spear.c +13 -3
index 31ff3fc..2ff867b 100644
@@ -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)
Signature · 1 line
1.7.9.5
#49 lore raw

v3 cover USB: OHCI:Properly handle ohci_suspend()routine in bus glue

In reply to Manjunath Goudar

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(-)
Signature · 1 line
1.7.9.5
#50 lore raw

PATCH v3 1/11 USB: OHCI: Properly handle OHCI controller suspend

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

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
Cc linux-usb at vger.kernel.org

V3: New patch.

---
 drivers/usb/host/ohci-hcd.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/usb/host/ohci-hcd.c +8 -1
index b69a49e..f3dcaa2 100644
@@ -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);
 
Signature · 1 line
1.7.9.5
#51 lore raw

PATCH v3 2/11 USB: OHCI: Properly handle ohci-at91 suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
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(-)
drivers/usb/host/ohci-at91.c +8 -2
index fb2f127..e34baa6 100644
@@ -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)
Signature · 1 line
1.7.9.5
#52 lore raw

PATCH v3 3/11 USB: OHCI: Properly handle ohci-s3c2410 suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
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(-)
drivers/usb/host/ohci-s3c2410.c +4 -15
index 8018bb1..70a7ca1 100644
@@ -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;
 }
Signature · 1 line
1.7.9.5
#53 lore raw

PATCH v3 4/11 USB: OHCI: Properly handle ohci-da8xx suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
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(-)
drivers/usb/host/ohci-da8xx.c +12 -5
index 6aaa9c9..78a6124 100644
@@ -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)
Signature · 1 line
1.7.9.5
#54 lore raw

PATCH v3 5/11 USB: OHCI: Properly handle ohci-ep93xx suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
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(-)
drivers/usb/host/ohci-ep93xx.c +9 -1
index 8704e9f..f5f11d1 100644
@@ -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)
Signature · 1 line
1.7.9.5
#55 lore raw

PATCH v3 5/11 USB: OHCI: Properly handle ohci-ep93xx suspend

Hello.

Quoted 26 lines · Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
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(-)
drivers/usb/host/ohci-ep93xx.c +0 -0
index 8704e9f..f5f11d1 100644

drivers/usb/host/ohci-ep93xx.c static int ohci_hcd_ep93xx_drv_suspend(struct platform_device *pdev, pm_message_ · line 178

Quoted 5 lines
drivers/usb/host/ohci-ep93xx.c +2 -0
@@ -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

A message that is not in the archive (sent off-list or not yet received): CAJFYCKGck29t211NTmXSKPtFdah3Pbe8T0UVZDsqWqqax3OL7g@mail.gmail.com

#57 lore raw

PATCH v3 5/11 USB: OHCI: Properly handle ohci-ep93xx suspend

Quoted 9 lines · Manjunath Goudar

On 19 June 2013 18:13, Sergei Shtylyov <[email protected]>

Quoted 8 lines · Manjunath Goudar
Quoted 5 lines
        struct usb_hcd *hcd = platform_get_drvdata(pdev);
        struct ohci_hcd *ohci = hcd_to_ohci(hcd);
drivers/usb/host/ohci-ep93xx.c +2 -0
+       bool    do_wakeup = device_may_wakeup(&pdev->dev);
+       int             ret;
Quoted 5 lines
Quoted 2 lines

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

#58 lore raw

PATCH v3 5/11 USB: OHCI: Properly handle ohci-ep93xx suspend

In reply to a message not in the archive

Hello.

Quoted 41 lines · Manjunath Goudar

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.

<mailto:[email protected]>>
Cc: Arnd Bergmann <arnd at arndb.de <mailto:[email protected]>>
Cc: Alan Stern <[email protected] <mailto:[email protected]>>
Cc: Greg KH <greg at kroah.com <mailto:[email protected]>>
Cc: linux-usb at vger.kernel.org <mailto:[email protected]>

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;

Quoted 7 lines

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.

Quoted 1 line

Manjunath Goudar

WBR, Sergei

#59 lore raw

PATCH v3 6/11 USB: OHCI: Properly handle ohci-exynos suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
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(-)
drivers/usb/host/ohci-exynos.c +7 -17
index ae6068d..b5926f8 100644
@@ -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;
Signature · 1 line
1.7.9.5
#60 lore raw

PATCH v3 6/11 USB: OHCI: Properly handle ohci-exynos suspend

Quoted 29 lines · Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
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(-)
drivers/usb/host/ohci-exynos.c +0 -0
index ae6068d..b5926f8 100644

drivers/usb/host/ohci-exynos.c static int exynos_ohci_suspend(struct device *dev) · line 208

Quoted 8 lines
drivers/usb/host/ohci-exynos.c +3 -2
@@ -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

#61 lore raw

PATCH v3 7/11 USB: OHCI: Properly handle ohci-omap suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
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(-)
drivers/usb/host/ohci-omap.c +10 -3
index 10ba58d..4bd1e8f 100644
@@ -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)
Signature · 1 line
1.7.9.5
#62 lore raw

PATCH v3 8/11 USB: OHCI: Properly handle ohci-platform suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
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(-)
drivers/usb/host/ohci-platform.c +8 -1
index bc30475..f4830a5 100644
@@ -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)
Signature · 1 line
1.7.9.5
#63 lore raw

PATCH v3 8/11 USB: OHCI: Properly handle ohci-platform suspend

Quoted 27 lines · Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
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(-)
drivers/usb/host/ohci-platform.c +0 -0
index bc30475..f4830a5 100644

drivers/usb/host/ohci-platform.c static int ohci_platform_remove(struct platform_device *dev) · line 145

Quoted 7 lines
drivers/usb/host/ohci-platform.c +1 -0
@@ -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... :-/

drivers/usb/host/ohci-platform.c static int ohci_platform_remove(struct platform_device *dev) · line 147

Quoted 2 lines
drivers/usb/host/ohci-platform.c +2 -0
+	bool		do_wakeup = device_may_wakeup(dev);
+	int		ret;

WBR, Sergei

#64 lore raw

PATCH v3 9/11 USB: OHCI: Properly handle ohci-pxa27x suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
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(-)
drivers/usb/host/ohci-pxa27x.c +7 -1
index 3a9c01d..1dc2a72 100644
@@ -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)
Signature · 1 line
1.7.9.5
#65 lore raw

PATCH v3 9/11 USB: OHCI: Properly handle ohci-pxa27x suspend

Quoted 26 lines · Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
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(-)
drivers/usb/host/ohci-pxa27x.c +0 -0
index 3a9c01d..1dc2a72 100644

drivers/usb/host/ohci-pxa27x.c static int ohci_hcd_pxa27x_drv_suspend(struct device *dev) · line 568

Quoted 5 lines
drivers/usb/host/ohci-pxa27x.c +2 -0
@@ -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

#66 lore raw

PATCH v3 10/11 USB: OHCI: Properly handle ohci-sm501 suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
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(-)
drivers/usb/host/ohci-sm501.c +9 -2
index d479d5d..e6c8db6 100644
@@ -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)
Signature · 1 line
1.7.9.5
#67 lore raw

PATCH v3 11/11 USB: OHCI: Properly handle ohci-spear suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
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(-)
drivers/usb/host/ohci-spear.c +9 -3
index 31ff3fc..a3b2696 100644
@@ -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)
Signature · 1 line
1.7.9.5
#68 lore raw

PATCH v3 11/11 USB: OHCI: Properly handle ohci-spear suspend

Quoted 29 lines · Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
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(-)
drivers/usb/host/ohci-spear.c +0 -0
index 31ff3fc..a3b2696 100644
@@ -130,20 +130,26 @@ static int spear_ohci_hcd_drv_remove(struct platform_device *pdev)
  }
 
  #if defined(CONFIG_PM)

drivers/usb/host/ohci-spear.c static int spear_ohci_hcd_drv_remove(struct platform_device *pdev) · line 140

Quoted 10 lines
drivers/usb/host/ohci-spear.c +4 -2
-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

#69 lore raw

v4 cover USB: OHCI:Properly handle ohci_suspend()routine in bus glue

In reply to Manjunath Goudar

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(-)
Signature · 1 line
1.7.9.5
#70 lore raw

PATCH v4 1/11 USB: OHCI: Properly handle OHCI controller suspend

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

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
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(-)
drivers/usb/host/ohci-hcd.c +8 -1
index b69a49e..f3dcaa2 100644
@@ -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);
 
Signature · 1 line
1.7.9.5
#71 lore raw

PATCH v4 2/11 USB: OHCI: Properly handle ohci-at91 suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
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(-)
drivers/usb/host/ohci-at91.c +8 -2
index fb2f127..e34baa6 100644
@@ -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)
Signature · 1 line
1.7.9.5
#72 lore raw

PATCH v4 3/11 USB: OHCI: Properly handle ohci-s3c2410 suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
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(-)
drivers/usb/host/ohci-s3c2410.c +4 -15
index 8018bb1..4ccf156 100644
@@ -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;
 }
Signature · 1 line
1.7.9.5
#73 lore raw

PATCH v4 4/11 USB: OHCI: Properly handle ohci-da8xx suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
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(-)
drivers/usb/host/ohci-da8xx.c +11 -4
index 6aaa9c9..44893cf 100644
@@ -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)
Signature · 1 line
1.7.9.5
#74 lore raw

PATCH v4 4/11 USB: OHCI: Properly handle ohci-da8xx suspend

Hello.

Quoted 31 lines · Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
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(-)
drivers/usb/host/ohci-da8xx.c +0 -0
index 6aaa9c9..44893cf 100644

drivers/usb/host/ohci-da8xx.c static int ohci_hcd_da8xx_drv_remove(struct platform_device *dev) · line 410

Quoted 6 lines
drivers/usb/host/ohci-da8xx.c +2 -1
@@ -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.

drivers/usb/host/ohci-da8xx.c static int ohci_hcd_da8xx_drv_remove(struct platform_device *dev) · line 415

Quoted 6 lines
drivers/usb/host/ohci-da8xx.c +3 -1
  {
-	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

#75 lore raw

PATCH v4 5/11 USB: OHCI: Properly handle ohci-ep93xx suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
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(-)
drivers/usb/host/ohci-ep93xx.c +8 -1
index 8704e9f..f0aaa48 100644
@@ -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)
Signature · 1 line
1.7.9.5
#76 lore raw

PATCH v4 6/11 USB: OHCI: Properly handle ohci-exynos suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
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(-)
drivers/usb/host/ohci-exynos.c +5 -15
index ae6068d..17de3dd 100644
@@ -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;
Signature · 1 line
1.7.9.5
#77 lore raw

PATCH v4 7/11 USB: OHCI: Properly handle ohci-omap suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
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(-)
drivers/usb/host/ohci-omap.c +10 -3
index 10ba58d..baefc46 100644
@@ -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)
Signature · 1 line
1.7.9.5
#78 lore raw

PATCH v4 8/11 USB: OHCI: Properly handle ohci-platform suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
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(-)
drivers/usb/host/ohci-platform.c +8 -1
index bc30475..b4a8784 100644
@@ -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)
Signature · 1 line
1.7.9.5
#79 lore raw

PATCH v4 9/11 USB: OHCI: Properly handle ohci-pxa27x suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
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(-)
drivers/usb/host/ohci-pxa27x.c +7 -1
index 3a9c01d..5fb91f1 100644
@@ -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)
Signature · 1 line
1.7.9.5
#80 lore raw

PATCH v4 10/11 USB: OHCI: Properly handle ohci-sm501 suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
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(-)
drivers/usb/host/ohci-sm501.c +9 -2
index d479d5d..2a5de5f 100644
@@ -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)
Signature · 1 line
1.7.9.5
#81 lore raw

PATCH v4 11/11 USB: OHCI: Properly handle ohci-spear suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
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(-)
drivers/usb/host/ohci-spear.c +9 -3
index 31ff3fc..41148f8 100644
@@ -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)
Signature · 1 line
1.7.9.5
maintainer
#82 lore raw

v4 cover USB: OHCI:Properly handle ohci_suspend()routine in bus glue

In reply to Manjunath Goudar
Quoted 5 lines · Manjunath Goudar

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.

Quoted 8 lines

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:

#83 lore raw

v4 cover USB: OHCI:Properly handle ohci_suspend()routine in bus glue

In reply to Manjunath Goudar

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(-)
Signature · 1 line
1.7.9.5
#84 lore raw

PATCH v4 1/11 USB: OHCI: Properly handle OHCI controller suspend

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

Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
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(-)
drivers/usb/host/ohci-hcd.c +8 -1
index b69a49e..f3dcaa2 100644
@@ -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);
 
Signature · 1 line
1.7.9.5
#85 lore raw

PATCH v4 2/11 USB: OHCI: Properly handle ohci-at91 suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
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(-)
drivers/usb/host/ohci-at91.c +8 -2
index 4c01759..09f17d1 100644
@@ -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)
Signature · 1 line
1.7.9.5
#86 lore raw

PATCH v4 3/11 USB: OHCI: Properly handle ohci-s3c2410 suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
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(-)
drivers/usb/host/ohci-s3c2410.c +4 -15
index b0f6644..4189aaa 100644
@@ -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;
 }
Signature · 1 line
1.7.9.5
#87 lore raw

PATCH v4 4/11 USB: OHCI: Properly handle ohci-da8xx suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
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(-)
drivers/usb/host/ohci-da8xx.c +11 -4
index 6aaa9c9..c649a35 100644
@@ -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)
Signature · 1 line
1.7.9.5
#88 lore raw

PATCH v4 5/11 USB: OHCI: Properly handle ohci-ep93xx suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
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(-)
drivers/usb/host/ohci-ep93xx.c +8 -1
index 8704e9f..f0aaa48 100644
@@ -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)
Signature · 1 line
1.7.9.5
#89 lore raw

PATCH v4 6/11 USB: OHCI: Properly handle ohci-exynos suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
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(-)
drivers/usb/host/ohci-exynos.c +5 -15
index ae6068d..17de3dd 100644
@@ -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;
Signature · 1 line
1.7.9.5
#90 lore raw

PATCH v4 7/11 USB: OHCI: Properly handle ohci-omap suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
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(-)
drivers/usb/host/ohci-omap.c +10 -3
index 10ba58d..baefc46 100644
@@ -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)
Signature · 1 line
1.7.9.5
#91 lore raw

PATCH v4 8/11 USB: OHCI: Properly handle ohci-platform suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
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(-)
drivers/usb/host/ohci-platform.c +8 -1
index bc30475..b4a8784 100644
@@ -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)
Signature · 1 line
1.7.9.5
#92 lore raw

PATCH v4 9/11 USB: OHCI: Properly handle ohci-pxa27x suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
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(-)
drivers/usb/host/ohci-pxa27x.c +7 -1
index 3a9c01d..5fb91f1 100644
@@ -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)
Signature · 1 line
1.7.9.5
#93 lore raw

PATCH v4 10/11 USB: OHCI: Properly handle ohci-sm501 suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
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(-)
drivers/usb/host/ohci-sm501.c +9 -2
index d479d5d..2a5de5f 100644
@@ -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)
Signature · 1 line
1.7.9.5
#94 lore raw

PATCH v4 11/11 USB: OHCI: Properly handle ohci-spear suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
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(-)
drivers/usb/host/ohci-spear.c +9 -3
index 31ff3fc..41148f8 100644
@@ -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)
Signature · 1 line
1.7.9.5
#95 lore raw

cover USB: OHCI:Properly handle ohci_suspend()routine in bus glue

In reply to Manjunath Goudar

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(-)
Signature · 1 line
1.7.9.5
#96 lore raw

PATCH 1/11 USB: OHCI: Properly handle OHCI controller suspend

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

Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
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(-)
drivers/usb/host/ohci-hcd.c +8 -1
index b69a49e..f3dcaa2 100644
@@ -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);
 
Signature · 1 line
1.7.9.5
#97 lore raw

PATCH 2/11 USB: OHCI: Properly handle ohci-at91 suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
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(-)
drivers/usb/host/ohci-at91.c +8 -2
index 08e28eb..008645c 100644
@@ -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)
Signature · 1 line
1.7.9.5
#98 lore raw

PATCH 3/11 USB: OHCI: Properly handle ohci-s3c2410 suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
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(-)
drivers/usb/host/ohci-s3c2410.c +4 -15
index 48b5948..d4cdf9c 100644
@@ -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;
 }
Signature · 1 line
1.7.9.5
#99 lore raw

PATCH 4/11 USB: OHCI: Properly handle ohci-da8xx suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
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(-)
drivers/usb/host/ohci-da8xx.c +11 -4
index 6aaa9c9..c649a35 100644
@@ -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)
Signature · 1 line
1.7.9.5
#100 lore raw

PATCH 4/11 USB: OHCI: Properly handle ohci-da8xx suspend

Hello.

Quoted 31 lines · Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
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(-)
drivers/usb/host/ohci-da8xx.c +0 -0
index 6aaa9c9..c649a35 100644

drivers/usb/host/ohci-da8xx.c static int ohci_hcd_da8xx_drv_remove(struct platform_device *dev) · line 410

Quoted 6 lines
drivers/usb/host/ohci-da8xx.c +2 -1
@@ -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

#101 lore raw

PATCH 5/11 USB: OHCI: Properly handle ohci-ep93xx suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
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(-)
drivers/usb/host/ohci-ep93xx.c +8 -1
index 8704e9f..f0aaa48 100644
@@ -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)
Signature · 1 line
1.7.9.5
#102 lore raw

PATCH 6/11 USB: OHCI: Properly handle ohci-exynos suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
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(-)
drivers/usb/host/ohci-exynos.c +5 -15
index ae6068d..17de3dd 100644
@@ -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;
Signature · 1 line
1.7.9.5
#103 lore raw

PATCH 7/11 USB: OHCI: Properly handle ohci-omap suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
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(-)
drivers/usb/host/ohci-omap.c +10 -3
index 8149ef0..d13fb4f 100644
@@ -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)
Signature · 1 line
1.7.9.5
#104 lore raw

PATCH 8/11 USB: OHCI: Properly handle ohci-platform suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
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(-)
drivers/usb/host/ohci-platform.c +8 -1
index bc30475..b4a8784 100644
@@ -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)
Signature · 1 line
1.7.9.5
#105 lore raw

PATCH 9/11 USB: OHCI: Properly handle ohci-pxa27x suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
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(-)
drivers/usb/host/ohci-pxa27x.c +7 -1
index 3a9c01d..5fb91f1 100644
@@ -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)
Signature · 1 line
1.7.9.5
#106 lore raw

PATCH 10/11 USB: OHCI: Properly handle ohci-sm501 suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
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(-)
drivers/usb/host/ohci-sm501.c +9 -2
index d479d5d..2a5de5f 100644
@@ -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)
Signature · 1 line
1.7.9.5
#107 lore raw

PATCH 11/11 USB: OHCI: Properly handle ohci-spear suspend

In reply to Manjunath Goudar

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.

Cc Arnd Bergmann <[email protected]>
Cc Greg KH <[email protected]>
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(-)
drivers/usb/host/ohci-spear.c +9 -3
index 31ff3fc..41148f8 100644
@@ -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)
Signature · 1 line
1.7.9.5
author
#108 lore raw

v4 cover USB: OHCI:Properly handle ohci_suspend()routine in bus glue

In reply to Manjunath Goudar
Quoted 27 lines · Manjunath Goudar

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

Quoted 13 lines
  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

#109 lore raw

v4 cover USB: OHCI:Properly handle ohci_suspend()routine in bus glue

Quoted 41 lines · manjunath
Quoted 27 lines · Manjunath Goudar

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

Quoted 13 lines
 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(-)
Quoted 1 line

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