diff options
author | Felipe Balbi <balbi@ti.com> | 2012-10-19 03:55:16 -0400 |
---|---|---|
committer | Sarah Sharp <sarah.a.sharp@linux.intel.com> | 2012-11-12 14:45:34 -0500 |
commit | 77b847677e7cb633627a9ddaa7efbc3fa8586427 (patch) | |
tree | ef429fad8f64d69f81e028fa32ace84705dd5997 | |
parent | b0e4e606ff6ff26da0f60826e75577b56ba4e463 (diff) |
usb: host: xhci: move HC_STATE_SUSPENDED check to xhci_suspend()
that check will have to be done by all users
of xhci_suspend() so it sounds a lot better to
move the check to xhci_suspend() in order to
avoid code duplication.
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
-rw-r--r-- | drivers/usb/host/xhci-pci.c | 9 | ||||
-rw-r--r-- | drivers/usb/host/xhci.c | 4 |
2 files changed, 5 insertions, 8 deletions
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index dcb72f724d0e..af259e0ec172 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c | |||
@@ -221,15 +221,8 @@ static void xhci_pci_remove(struct pci_dev *dev) | |||
221 | static int xhci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup) | 221 | static int xhci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup) |
222 | { | 222 | { |
223 | struct xhci_hcd *xhci = hcd_to_xhci(hcd); | 223 | struct xhci_hcd *xhci = hcd_to_xhci(hcd); |
224 | int retval = 0; | ||
225 | 224 | ||
226 | if (hcd->state != HC_STATE_SUSPENDED || | 225 | return xhci_suspend(xhci); |
227 | xhci->shared_hcd->state != HC_STATE_SUSPENDED) | ||
228 | return -EINVAL; | ||
229 | |||
230 | retval = xhci_suspend(xhci); | ||
231 | |||
232 | return retval; | ||
233 | } | 226 | } |
234 | 227 | ||
235 | static int xhci_pci_resume(struct usb_hcd *hcd, bool hibernated) | 228 | static int xhci_pci_resume(struct usb_hcd *hcd, bool hibernated) |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 09987d57934c..5c72c431bab1 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -880,6 +880,10 @@ int xhci_suspend(struct xhci_hcd *xhci) | |||
880 | struct usb_hcd *hcd = xhci_to_hcd(xhci); | 880 | struct usb_hcd *hcd = xhci_to_hcd(xhci); |
881 | u32 command; | 881 | u32 command; |
882 | 882 | ||
883 | if (hcd->state != HC_STATE_SUSPENDED || | ||
884 | xhci->shared_hcd->state != HC_STATE_SUSPENDED) | ||
885 | return -EINVAL; | ||
886 | |||
883 | spin_lock_irq(&xhci->lock); | 887 | spin_lock_irq(&xhci->lock); |
884 | clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); | 888 | clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); |
885 | clear_bit(HCD_FLAG_HW_ACCESSIBLE, &xhci->shared_hcd->flags); | 889 | clear_bit(HCD_FLAG_HW_ACCESSIBLE, &xhci->shared_hcd->flags); |