usb: xhci: Fix suspend/resume when used with OTG core
authorRoger Quadros <rogerq@ti.com>
Fri, 29 May 2015 14:01:50 +0000 (17:01 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 31 May 2015 06:45:31 +0000 (15:45 +0900)
commit9fa733f24bb54dd532b5f5d7abc275c4a547c69f
treec8a21e12577e19b7c1941af0b5de9c493c9616a6
parentad6b1d914a9e07f3b9a9ae3396f3c840d0070539
usb: xhci: Fix suspend/resume when used with OTG core

In the OTG case, the controller might not yet have been
added or is removed before the system suspends.

Assign xhci->main_hcd during probe to prevent NULL
pointer de-reference in xhci_suspend/resume().

Use the hcd->state flag to check if HCD is halted
and if that is so do nothing for xhci_suspend/resume().

[Only for xhci-plat devices, pci devices need it in gen_setup -Mathias]
Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/xhci-plat.c
drivers/usb/host/xhci.c