fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / drivers / usb / host / sl811-hcd.c
index 517360b..5fa5647 100644 (file)
@@ -31,7 +31,6 @@
 #undef VERBOSE
 #undef PACKET_TRACE
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/kernel.h>
@@ -46,7 +45,7 @@
 #include <linux/list.h>
 #include <linux/interrupt.h>
 #include <linux/usb.h>
-#include <linux/usb_sl811.h>
+#include <linux/usb/sl811.h>
 #include <linux/platform_device.h>
 
 #include <asm/io.h>
@@ -429,7 +428,6 @@ static void finish_request(
        struct sl811            *sl811,
        struct sl811h_ep        *ep,
        struct urb              *urb,
-       struct pt_regs          *regs,
        int                     status
 ) __releases(sl811->lock) __acquires(sl811->lock)
 {
@@ -445,7 +443,7 @@ static void finish_request(
        spin_unlock(&urb->lock);
 
        spin_unlock(&sl811->lock);
-       usb_hcd_giveback_urb(sl811_to_hcd(sl811), urb, regs);
+       usb_hcd_giveback_urb(sl811_to_hcd(sl811), urb);
        spin_lock(&sl811->lock);
 
        /* leave active endpoints in the schedule */
@@ -485,7 +483,7 @@ static void finish_request(
 }
 
 static void
-done(struct sl811 *sl811, struct sl811h_ep *ep, u8 bank, struct pt_regs *regs)
+done(struct sl811 *sl811, struct sl811h_ep *ep, u8 bank)
 {
        u8                      status;
        struct urb              *urb;
@@ -598,7 +596,7 @@ done(struct sl811 *sl811, struct sl811h_ep *ep, u8 bank, struct pt_regs *regs)
        /* error? retry, until "3 strikes" */
        } else if (++ep->error_count >= 3) {
                if (status & SL11H_STATMASK_TMOUT)
-                       urbstat = -ETIMEDOUT;
+                       urbstat = -ETIME;
                else if (status & SL11H_STATMASK_OVF)
                        urbstat = -EOVERFLOW;
                else
@@ -609,7 +607,7 @@ done(struct sl811 *sl811, struct sl811h_ep *ep, u8 bank, struct pt_regs *regs)
        }
 
        if (urb && (urbstat != -EINPROGRESS || urb->status != -EINPROGRESS))
-               finish_request(sl811, ep, urb, regs, urbstat);
+               finish_request(sl811, ep, urb, urbstat);
 }
 
 static inline u8 checkdone(struct sl811 *sl811)
@@ -642,7 +640,7 @@ static inline u8 checkdone(struct sl811 *sl811)
        return irqstat;
 }
 
-static irqreturn_t sl811h_irq(struct usb_hcd *hcd, struct pt_regs *regs)
+static irqreturn_t sl811h_irq(struct usb_hcd *hcd)
 {
        struct sl811    *sl811 = hcd_to_sl811(hcd);
        u8              irqstat;
@@ -671,13 +669,13 @@ retry:
         * issued ... that's fine if they're different endpoints.
         */
        if (irqstat & SL11H_INTMASK_DONE_A) {
-               done(sl811, sl811->active_a, SL811_EP_A(SL811_HOST_BUF), regs);
+               done(sl811, sl811->active_a, SL811_EP_A(SL811_HOST_BUF));
                sl811->active_a = NULL;
                sl811->stat_a++;
        }
 #ifdef USE_B
        if (irqstat & SL11H_INTMASK_DONE_B) {
-               done(sl811, sl811->active_b, SL811_EP_B(SL811_HOST_BUF), regs);
+               done(sl811, sl811->active_b, SL811_EP_B(SL811_HOST_BUF));
                sl811->active_b = NULL;
                sl811->stat_b++;
        }
@@ -724,7 +722,7 @@ retry:
                                container_of(sl811->active_a
                                                ->hep->urb_list.next,
                                        struct urb, urb_list),
-                               NULL, -ESHUTDOWN);
+                               -ESHUTDOWN);
                        sl811->active_a = NULL;
                }
 #ifdef USE_B
@@ -853,7 +851,7 @@ static int sl811h_urb_enqueue(
 
        } else {
                INIT_LIST_HEAD(&ep->schedule);
-               ep->udev = usb_get_dev(udev);
+               ep->udev = udev;
                ep->epnum = epnum;
                ep->maxpacket = usb_maxpacket(udev, urb->pipe, is_out);
                ep->defctrl = SL11H_HCTLMASK_ARM | SL11H_HCTLMASK_ENABLE;
@@ -958,7 +956,7 @@ static int sl811h_urb_enqueue(
        spin_lock(&urb->lock);
        if (urb->status != -EINPROGRESS) {
                spin_unlock(&urb->lock);
-               finish_request(sl811, ep, urb, NULL, 0);
+               finish_request(sl811, ep, urb, 0);
                retval = 0;
                goto fail;
        }
@@ -1027,7 +1025,7 @@ static int sl811h_urb_dequeue(struct usb_hcd *hcd, struct urb *urb)
                }
 
                if (urb)
-                       finish_request(sl811, ep, urb, NULL, 0);
+                       finish_request(sl811, ep, urb, 0);
                else
                        VDBG("dequeue, urb %p active %s; wait4irq\n", urb,
                                (sl811->active_a == ep) ? "A" : "B");
@@ -1052,7 +1050,6 @@ sl811h_endpoint_disable(struct usb_hcd *hcd, struct usb_host_endpoint *hep)
        if (!list_empty(&hep->urb_list))
                WARN("ep %p not empty?\n", ep);
 
-       usb_put_dev(ep->udev);
        kfree(ep);
        hep->hcpriv = NULL;
 }
@@ -1085,7 +1082,7 @@ sl811h_hub_status_data(struct usb_hcd *hcd, char *buf)
         */
        local_irq_save(flags);
        if (!timer_pending(&sl811->timer)) {
-               if (sl811h_irq( /* ~0, */ hcd, NULL) != IRQ_NONE)
+               if (sl811h_irq( /* ~0, */ hcd) != IRQ_NONE)
                        sl811->stat_lost++;
        }
        local_irq_restore(flags);
@@ -1519,7 +1516,7 @@ static int proc_sl811h_open(struct inode *inode, struct file *file)
        return single_open(file, proc_sl811h_show, PDE(inode)->data);
 }
 
-static struct file_operations proc_ops = {
+static const struct file_operations proc_ops = {
        .open           = proc_sl811h_open,
        .read           = seq_read,
        .llseek         = seq_lseek,
@@ -1685,9 +1682,13 @@ sl811h_probe(struct platform_device *dev)
                if (!addr || !data)
                        return -ENODEV;
                ioaddr = 1;
-
-               addr_reg = (void __iomem *) addr->start;
-               data_reg = (void __iomem *) data->start;
+               /*
+                * NOTE: 64-bit resource->start is getting truncated
+                * to avoid compiler warning, assuming that ->start
+                * is always 32-bit for this case
+                */
+               addr_reg = (void __iomem *) (unsigned long) addr->start;
+               data_reg = (void __iomem *) (unsigned long) data->start;
        } else {
                addr_reg = ioremap(addr->start, 1);
                if (addr_reg == NULL) {
@@ -1747,7 +1748,7 @@ sl811h_probe(struct platform_device *dev)
         * was on a system with single edge triggering, so most sorts of
         * triggering arrangement should work.
         */
-       retval = usb_add_hcd(hcd, irq, SA_INTERRUPT | SA_SHIRQ);
+       retval = usb_add_hcd(hcd, irq, IRQF_DISABLED | IRQF_SHARED);
        if (retval != 0)
                goto err6;
 
@@ -1781,10 +1782,15 @@ sl811h_suspend(struct platform_device *dev, pm_message_t state)
        struct sl811    *sl811 = hcd_to_sl811(hcd);
        int             retval = 0;
 
-       if (state.event == PM_EVENT_FREEZE)
+       switch (state.event) {
+       case PM_EVENT_FREEZE:
                retval = sl811h_bus_suspend(hcd);
-       else if (state.event == PM_EVENT_SUSPEND)
+               break;
+       case PM_EVENT_SUSPEND:
+       case PM_EVENT_PRETHAW:          /* explicitly discard hw state */
                port_power(sl811, 0);
+               break;
+       }
        if (retval == 0)
                dev->dev.power.power_state = state;
        return retval;