]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/usb/host/sl811-hcd.c
PM: Introduce PM_EVENT_HIBERNATE callback state
[linux-2.6-omap-h63xx.git] / drivers / usb / host / sl811-hcd.c
index f0fa94148d9da85f56ba4af2b3be57067fd00b36..59be276ccd9dc112b883e8954734d74936e78f14 100644 (file)
@@ -435,13 +435,9 @@ static void finish_request(
        if (usb_pipecontrol(urb->pipe))
                ep->nextpid = USB_PID_SETUP;
 
-       spin_lock(&urb->lock);
-       urb->status = status;
-       spin_unlock(&urb->lock);
-
        usb_hcd_unlink_urb_from_ep(sl811_to_hcd(sl811), urb);
        spin_unlock(&sl811->lock);
-       usb_hcd_giveback_urb(sl811_to_hcd(sl811), urb);
+       usb_hcd_giveback_urb(sl811_to_hcd(sl811), urb, status);
        spin_lock(&sl811->lock);
 
        /* leave active endpoints in the schedule */
@@ -537,27 +533,20 @@ done(struct sl811 *sl811, struct sl811h_ep *ep, u8 bank)
                                                bank + SL11H_XFERCNTREG);
                        if (len > ep->length) {
                                len = ep->length;
-                               urb->status = -EOVERFLOW;
+                               urbstat = -EOVERFLOW;
                        }
                        urb->actual_length += len;
                        sl811_read_buf(sl811, SL811HS_PACKET_BUF(bank == 0),
                                        buf, len);
                        usb_dotoggle(udev, ep->epnum, 0);
-                       if (urb->actual_length == urb->transfer_buffer_length
-                                       || len < ep->maxpacket)
-                               urbstat = 0;
-                       if (usb_pipecontrol(urb->pipe) && urbstat == 0) {
-
-                               /* NOTE if the status stage STALLs (why?),
-                                * this reports the wrong urb status.
-                                */
-                               spin_lock(&urb->lock);
-                               if (urb->status == -EINPROGRESS)
-                                       urb->status = urbstat;
-                               spin_unlock(&urb->lock);
-
-                               urb = NULL;
-                               ep->nextpid = USB_PID_ACK;
+                       if (urbstat == -EINPROGRESS &&
+                                       (len < ep->maxpacket ||
+                                               urb->actual_length ==
+                                               urb->transfer_buffer_length)) {
+                               if (usb_pipecontrol(urb->pipe))
+                                       ep->nextpid = USB_PID_ACK;
+                               else
+                                       urbstat = 0;
                        }
                        break;
                case USB_PID_SETUP:
@@ -597,7 +586,7 @@ done(struct sl811 *sl811, struct sl811h_ep *ep, u8 bank)
                                bank, status, ep, urbstat);
        }
 
-       if (urb && (urbstat != -EINPROGRESS || urb->unlinked))
+       if (urbstat != -EINPROGRESS || urb->unlinked)
                finish_request(sl811, ep, urb, urbstat);
 }
 
@@ -1567,7 +1556,7 @@ sl811h_start(struct usb_hcd *hcd)
                hcd->power_budget = sl811->board->power * 2;
        }
 
-       /* enable power and interupts */
+       /* enable power and interrupts */
        port_power(sl811, 1);
 
        return 0;
@@ -1777,6 +1766,7 @@ sl811h_suspend(struct platform_device *dev, pm_message_t state)
                retval = sl811h_bus_suspend(hcd);
                break;
        case PM_EVENT_SUSPEND:
+       case PM_EVENT_HIBERNATE:
        case PM_EVENT_PRETHAW:          /* explicitly discard hw state */
                port_power(sl811, 0);
                break;