]> git.karo-electronics.de Git - linux-beck.git/commitdiff
usb: host: xhci: move HC_STATE_SUSPENDED check to xhci_suspend()
authorFelipe Balbi <balbi@ti.com>
Fri, 19 Oct 2012 07:55:16 +0000 (10:55 +0300)
committerSarah Sharp <sarah.a.sharp@linux.intel.com>
Mon, 12 Nov 2012 19:45:34 +0000 (11:45 -0800)
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>
drivers/usb/host/xhci-pci.c
drivers/usb/host/xhci.c

index dcb72f724d0ef738d1bc8ba06a552990b7130de6..af259e0ec172aa4a5664ca15acb2adf8d90bf02c 100644 (file)
@@ -221,15 +221,8 @@ static void xhci_pci_remove(struct pci_dev *dev)
 static int xhci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup)
 {
        struct xhci_hcd *xhci = hcd_to_xhci(hcd);
-       int     retval = 0;
 
-       if (hcd->state != HC_STATE_SUSPENDED ||
-                       xhci->shared_hcd->state != HC_STATE_SUSPENDED)
-               return -EINVAL;
-
-       retval = xhci_suspend(xhci);
-
-       return retval;
+       return xhci_suspend(xhci);
 }
 
 static int xhci_pci_resume(struct usb_hcd *hcd, bool hibernated)
index 09987d57934c993d3bc1c45335bfff776af4a55d..5c72c431bab18da941ec9a1a235c134086065482 100644 (file)
@@ -880,6 +880,10 @@ int xhci_suspend(struct xhci_hcd *xhci)
        struct usb_hcd          *hcd = xhci_to_hcd(xhci);
        u32                     command;
 
+       if (hcd->state != HC_STATE_SUSPENDED ||
+                       xhci->shared_hcd->state != HC_STATE_SUSPENDED)
+               return -EINVAL;
+
        spin_lock_irq(&xhci->lock);
        clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
        clear_bit(HCD_FLAG_HW_ACCESSIBLE, &xhci->shared_hcd->flags);