pcmcia: pcmcia_config_loop() default CIS entry handling
[safe/jmp/linux-2.6] / drivers / usb / host / sl811-hcd.c
index f0fa941..8a74bbb 100644 (file)
@@ -58,6 +58,7 @@
 
 MODULE_DESCRIPTION("SL811HS USB Host Controller Driver");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:sl811-hcd");
 
 #define DRIVER_VERSION "19 May 2005"
 
@@ -93,12 +94,10 @@ static void port_power(struct sl811 *sl811, int is_on)
 
                sl811->port1 = (1 << USB_PORT_FEAT_POWER);
                sl811->irq_enable = SL11H_INTMASK_INSRMV;
-               hcd->self.controller->power.power_state = PMSG_ON;
        } else {
                sl811->port1 = 0;
                sl811->irq_enable = 0;
                hcd->state = HC_STATE_HALT;
-               hcd->self.controller->power.power_state = PMSG_SUSPEND;
        }
        sl811->ctrl1 = 0;
        sl811_write(sl811, SL11H_IRQ_ENABLE, 0);
@@ -435,13 +434,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 +532,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 +585,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);
 }
 
@@ -1038,7 +1026,7 @@ sl811h_endpoint_disable(struct usb_hcd *hcd, struct usb_host_endpoint *hep)
        if (!list_empty(&hep->urb_list))
                msleep(3);
        if (!list_empty(&hep->urb_list))
-               WARN("ep %p not empty?\n", ep);
+               WARNING("ep %p not empty?\n", ep);
 
        kfree(ep);
        hep->hcpriv = NULL;
@@ -1112,7 +1100,7 @@ sl811h_hub_descriptor (
        /* no overcurrent errors detection/handling */
        temp |= 0x0010;
 
-       desc->wHubCharacteristics = (__force __u16)cpu_to_le16(temp);
+       desc->wHubCharacteristics = cpu_to_le16(temp);
 
        /* two bitmaps:  ports removable, and legacy PortPwrCtrlMask */
        desc->bitmap[0] = 0 << 1;
@@ -1347,7 +1335,7 @@ static int
 sl811h_bus_suspend(struct usb_hcd *hcd)
 {
        // SOFs off
-       DBG("%s\n", __FUNCTION__);
+       DBG("%s\n", __func__);
        return 0;
 }
 
@@ -1355,7 +1343,7 @@ static int
 sl811h_bus_resume(struct usb_hcd *hcd)
 {
        // SOFs on
-       DBG("%s\n", __FUNCTION__);
+       DBG("%s\n", __func__);
        return 0;
 }
 
@@ -1518,15 +1506,7 @@ static const char proc_filename[] = "driver/sl811h";
 
 static void create_debug_file(struct sl811 *sl811)
 {
-       struct proc_dir_entry *pde;
-
-       pde = create_proc_entry(proc_filename, 0, NULL);
-       if (pde == NULL)
-               return;
-
-       pde->proc_fops = &proc_ops;
-       pde->data = sl811;
-       sl811->pde = pde;
+       sl811->pde = proc_create_data(proc_filename, 0, NULL, &proc_ops, sl811);
 }
 
 static void remove_debug_file(struct sl811 *sl811)
@@ -1567,7 +1547,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;
@@ -1694,7 +1674,7 @@ sl811h_probe(struct platform_device *dev)
        }
 
        /* allocate and initialize hcd */
-       hcd = usb_create_hcd(&sl811h_hc_driver, &dev->dev, dev->dev.bus_id);
+       hcd = usb_create_hcd(&sl811h_hc_driver, &dev->dev, dev_name(&dev->dev));
        if (!hcd) {
                retval = -ENOMEM;
                goto err5;
@@ -1777,12 +1757,11 @@ 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;
        }
-       if (retval == 0)
-               dev->dev.power.power_state = state;
        return retval;
 }
 
@@ -1795,15 +1774,13 @@ sl811h_resume(struct platform_device *dev)
        /* with no "check to see if VBUS is still powered" board hook,
         * let's assume it'd only be powered to enable remote wakeup.
         */
-       if (dev->dev.power.power_state.event == PM_EVENT_SUSPEND
-                       || !device_can_wakeup(&hcd->self.root_hub->dev)) {
+       if (!sl811->port1 || !device_can_wakeup(&hcd->self.root_hub->dev)) {
                sl811->port1 = 0;
                port_power(sl811, 1);
                usb_root_hub_lost_power(hcd->self.root_hub);
                return 0;
        }
 
-       dev->dev.power.power_state = PMSG_ON;
        return sl811h_bus_resume(hcd);
 }