Re: [PATCH] usb: host: ehci-msm: Conditionally call ehci suspend/resume

2016-05-26 Thread Pramod Gurav
On 21 May 2016 at 03:05, Andy Gross  wrote:
> This patch fixes a suspend/resume issue where the driver is blindly
> calling ehci_suspend/resume functions when the ehci hasn't been setup.
> This results in a crash during suspend/resume operations.
>
> Signed-off-by: Andy Gross 

Fixes below crash while doing a system suspend:

root@linaro-alip:~# echo freeze > /sys/power/state
[   22.348960] PM: Syncing filesystems ... done.
[   22.387778] Freezing user space processes ... (elapsed 0.001 seconds) done.
[   22.393614] Freezing remaining freezable tasks ... (elapsed 0.001
seconds) done.
[   22.512736] mmc0: Reset 0x1 never completed.
[   22.514296] Unable to handle kernel NULL pointer dereference at
virtual address 04e8
[   22.516068] pgd = 80003817d000
[   22.524161] [04e8] *pgd=b817e003,
*pud=b817f003, *pmd=
[   22.535414] Internal error: Oops: 9606 [#1] PREEMPT SMP
[   22.535680] Modules linked in:
[   22.544183] CPU: 3 PID: 1499 Comm: bash Not tainted 4.6.0+ #65
[   22.544275] Hardware name: Qualcomm Technologies, Inc. APQ 8016 SBC (DT)
[   22.550006] task: 800039abd780 ti: 80003928c000 task.ti:
80003928c000
[   22.556870] PC is at ehci_suspend+0x34/0xe4
[   22.564240] LR is at ehci_msm_pm_suspend+0x2c/0x34
[   22.568232] pc : [] lr : []
pstate: a145

Tested-by: Pramod Gurav 

> ---
>  drivers/usb/host/ehci-msm.c | 14 --
>  1 file changed, 12 insertions(+), 2 deletions(-)
>
Regards,
Pramod


Re: [PATCH] usb: host: ehci-msm: Conditionally call ehci suspend/resume

2016-05-26 Thread Pramod Gurav
On 21 May 2016 at 03:05, Andy Gross  wrote:
> This patch fixes a suspend/resume issue where the driver is blindly
> calling ehci_suspend/resume functions when the ehci hasn't been setup.
> This results in a crash during suspend/resume operations.
>
> Signed-off-by: Andy Gross 

Fixes below crash while doing a system suspend:

root@linaro-alip:~# echo freeze > /sys/power/state
[   22.348960] PM: Syncing filesystems ... done.
[   22.387778] Freezing user space processes ... (elapsed 0.001 seconds) done.
[   22.393614] Freezing remaining freezable tasks ... (elapsed 0.001
seconds) done.
[   22.512736] mmc0: Reset 0x1 never completed.
[   22.514296] Unable to handle kernel NULL pointer dereference at
virtual address 04e8
[   22.516068] pgd = 80003817d000
[   22.524161] [04e8] *pgd=b817e003,
*pud=b817f003, *pmd=
[   22.535414] Internal error: Oops: 9606 [#1] PREEMPT SMP
[   22.535680] Modules linked in:
[   22.544183] CPU: 3 PID: 1499 Comm: bash Not tainted 4.6.0+ #65
[   22.544275] Hardware name: Qualcomm Technologies, Inc. APQ 8016 SBC (DT)
[   22.550006] task: 800039abd780 ti: 80003928c000 task.ti:
80003928c000
[   22.556870] PC is at ehci_suspend+0x34/0xe4
[   22.564240] LR is at ehci_msm_pm_suspend+0x2c/0x34
[   22.568232] pc : [] lr : []
pstate: a145

Tested-by: Pramod Gurav 

> ---
>  drivers/usb/host/ehci-msm.c | 14 --
>  1 file changed, 12 insertions(+), 2 deletions(-)
>
Regards,
Pramod


Re: [PATCH] usb: host: ehci-msm: Conditionally call ehci suspend/resume

2016-05-21 Thread Alan Stern
On Fri, 20 May 2016, Andy Gross wrote:

> This patch fixes a suspend/resume issue where the driver is blindly
> calling ehci_suspend/resume functions when the ehci hasn't been setup.
> This results in a crash during suspend/resume operations.
> 
> Signed-off-by: Andy Gross 
> ---
>  drivers/usb/host/ehci-msm.c | 14 --
>  1 file changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/host/ehci-msm.c b/drivers/usb/host/ehci-msm.c
> index 3e226ef..9996a60 100644
> --- a/drivers/usb/host/ehci-msm.c
> +++ b/drivers/usb/host/ehci-msm.c
> @@ -179,22 +179,32 @@ static int ehci_msm_remove(struct platform_device *pdev)
>  static int ehci_msm_pm_suspend(struct device *dev)
>  {
>   struct usb_hcd *hcd = dev_get_drvdata(dev);
> + struct ehci_hcd *ehci = hcd_to_ehci(hcd);
>   bool do_wakeup = device_may_wakeup(dev);
>  
>   dev_dbg(dev, "ehci-msm PM suspend\n");
>  
> - return ehci_suspend(hcd, do_wakeup);
> + /* Only call ehci_suspend if ehci_setup has been done */
> + if (ehci->sbrn)
> + return ehci_suspend(hcd, do_wakeup);
> +
> + return 0;
>  }
>  
>  static int ehci_msm_pm_resume(struct device *dev)
>  {
>   struct usb_hcd *hcd = dev_get_drvdata(dev);
> + struct ehci_hcd *ehci = hcd_to_ehci(hcd);
>  
>   dev_dbg(dev, "ehci-msm PM resume\n");
> - ehci_resume(hcd, false);
> +
> + /* Only call ehci_resume if ehci_setup has been done */
> + if (ehci->sbrn)
> + ehci_resume(hcd, false);
>  
>   return 0;
>  }
> +
>  #else
>  #define ehci_msm_pm_suspend  NULL
>  #define ehci_msm_pm_resume   NULL

Acked-by: Alan Stern 



Re: [PATCH] usb: host: ehci-msm: Conditionally call ehci suspend/resume

2016-05-21 Thread Alan Stern
On Fri, 20 May 2016, Andy Gross wrote:

> This patch fixes a suspend/resume issue where the driver is blindly
> calling ehci_suspend/resume functions when the ehci hasn't been setup.
> This results in a crash during suspend/resume operations.
> 
> Signed-off-by: Andy Gross 
> ---
>  drivers/usb/host/ehci-msm.c | 14 --
>  1 file changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/host/ehci-msm.c b/drivers/usb/host/ehci-msm.c
> index 3e226ef..9996a60 100644
> --- a/drivers/usb/host/ehci-msm.c
> +++ b/drivers/usb/host/ehci-msm.c
> @@ -179,22 +179,32 @@ static int ehci_msm_remove(struct platform_device *pdev)
>  static int ehci_msm_pm_suspend(struct device *dev)
>  {
>   struct usb_hcd *hcd = dev_get_drvdata(dev);
> + struct ehci_hcd *ehci = hcd_to_ehci(hcd);
>   bool do_wakeup = device_may_wakeup(dev);
>  
>   dev_dbg(dev, "ehci-msm PM suspend\n");
>  
> - return ehci_suspend(hcd, do_wakeup);
> + /* Only call ehci_suspend if ehci_setup has been done */
> + if (ehci->sbrn)
> + return ehci_suspend(hcd, do_wakeup);
> +
> + return 0;
>  }
>  
>  static int ehci_msm_pm_resume(struct device *dev)
>  {
>   struct usb_hcd *hcd = dev_get_drvdata(dev);
> + struct ehci_hcd *ehci = hcd_to_ehci(hcd);
>  
>   dev_dbg(dev, "ehci-msm PM resume\n");
> - ehci_resume(hcd, false);
> +
> + /* Only call ehci_resume if ehci_setup has been done */
> + if (ehci->sbrn)
> + ehci_resume(hcd, false);
>  
>   return 0;
>  }
> +
>  #else
>  #define ehci_msm_pm_suspend  NULL
>  #define ehci_msm_pm_resume   NULL

Acked-by: Alan Stern 



[PATCH] usb: host: ehci-msm: Conditionally call ehci suspend/resume

2016-05-20 Thread Andy Gross
This patch fixes a suspend/resume issue where the driver is blindly
calling ehci_suspend/resume functions when the ehci hasn't been setup.
This results in a crash during suspend/resume operations.

Signed-off-by: Andy Gross 
---
 drivers/usb/host/ehci-msm.c | 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/ehci-msm.c b/drivers/usb/host/ehci-msm.c
index 3e226ef..9996a60 100644
--- a/drivers/usb/host/ehci-msm.c
+++ b/drivers/usb/host/ehci-msm.c
@@ -179,22 +179,32 @@ static int ehci_msm_remove(struct platform_device *pdev)
 static int ehci_msm_pm_suspend(struct device *dev)
 {
struct usb_hcd *hcd = dev_get_drvdata(dev);
+   struct ehci_hcd *ehci = hcd_to_ehci(hcd);
bool do_wakeup = device_may_wakeup(dev);
 
dev_dbg(dev, "ehci-msm PM suspend\n");
 
-   return ehci_suspend(hcd, do_wakeup);
+   /* Only call ehci_suspend if ehci_setup has been done */
+   if (ehci->sbrn)
+   return ehci_suspend(hcd, do_wakeup);
+
+   return 0;
 }
 
 static int ehci_msm_pm_resume(struct device *dev)
 {
struct usb_hcd *hcd = dev_get_drvdata(dev);
+   struct ehci_hcd *ehci = hcd_to_ehci(hcd);
 
dev_dbg(dev, "ehci-msm PM resume\n");
-   ehci_resume(hcd, false);
+
+   /* Only call ehci_resume if ehci_setup has been done */
+   if (ehci->sbrn)
+   ehci_resume(hcd, false);
 
return 0;
 }
+
 #else
 #define ehci_msm_pm_suspendNULL
 #define ehci_msm_pm_resume NULL
-- 
1.9.1



[PATCH] usb: host: ehci-msm: Conditionally call ehci suspend/resume

2016-05-20 Thread Andy Gross
This patch fixes a suspend/resume issue where the driver is blindly
calling ehci_suspend/resume functions when the ehci hasn't been setup.
This results in a crash during suspend/resume operations.

Signed-off-by: Andy Gross 
---
 drivers/usb/host/ehci-msm.c | 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/ehci-msm.c b/drivers/usb/host/ehci-msm.c
index 3e226ef..9996a60 100644
--- a/drivers/usb/host/ehci-msm.c
+++ b/drivers/usb/host/ehci-msm.c
@@ -179,22 +179,32 @@ static int ehci_msm_remove(struct platform_device *pdev)
 static int ehci_msm_pm_suspend(struct device *dev)
 {
struct usb_hcd *hcd = dev_get_drvdata(dev);
+   struct ehci_hcd *ehci = hcd_to_ehci(hcd);
bool do_wakeup = device_may_wakeup(dev);
 
dev_dbg(dev, "ehci-msm PM suspend\n");
 
-   return ehci_suspend(hcd, do_wakeup);
+   /* Only call ehci_suspend if ehci_setup has been done */
+   if (ehci->sbrn)
+   return ehci_suspend(hcd, do_wakeup);
+
+   return 0;
 }
 
 static int ehci_msm_pm_resume(struct device *dev)
 {
struct usb_hcd *hcd = dev_get_drvdata(dev);
+   struct ehci_hcd *ehci = hcd_to_ehci(hcd);
 
dev_dbg(dev, "ehci-msm PM resume\n");
-   ehci_resume(hcd, false);
+
+   /* Only call ehci_resume if ehci_setup has been done */
+   if (ehci->sbrn)
+   ehci_resume(hcd, false);
 
return 0;
 }
+
 #else
 #define ehci_msm_pm_suspendNULL
 #define ehci_msm_pm_resume NULL
-- 
1.9.1