vserver 1.9.3
[linux-2.6.git] / drivers / usb / host / ehci-sched.c
index e067274..0000c46 100644 (file)
@@ -44,7 +44,7 @@ static int ehci_get_frame (struct usb_hcd *hcd);
  * @tag: hardware tag for type of this record
  */
 static union ehci_shadow *
-periodic_next_shadow (union ehci_shadow *periodic, int tag)
+periodic_next_shadow (union ehci_shadow *periodic, __le32 tag)
 {
        switch (tag) {
        case Q_TYPE_QH:
@@ -64,7 +64,7 @@ periodic_next_shadow (union ehci_shadow *periodic, int tag)
 static int periodic_unlink (struct ehci_hcd *ehci, unsigned frame, void *ptr)
 {
        union ehci_shadow       *prev_p = &ehci->pshadow [frame];
-       u32                     *hw_p = &ehci->periodic [frame];
+       __le32                  *hw_p = &ehci->periodic [frame];
        union ehci_shadow       here = *prev_p;
        union ehci_shadow       *next_p;
 
@@ -89,7 +89,7 @@ static int periodic_unlink (struct ehci_hcd *ehci, unsigned frame, void *ptr)
 
        /* unlink from shadow list; HCD won't see old structure again */
        *prev_p = *next_p;
-       next_p->ptr = 0;
+       next_p->ptr = NULL;
 
        return 1;
 }
@@ -98,7 +98,7 @@ static int periodic_unlink (struct ehci_hcd *ehci, unsigned frame, void *ptr)
 static unsigned short
 periodic_usecs (struct ehci_hcd *ehci, unsigned frame, unsigned uframe)
 {
-       u32                     *hw_p = &ehci->periodic [frame];
+       __le32                  *hw_p = &ehci->periodic [frame];
        union ehci_shadow       *q = &ehci->pshadow [frame];
        unsigned                usecs = 0;
 
@@ -196,7 +196,7 @@ static int tt_no_collision (
         */
        for (; frame < ehci->periodic_size; frame += period) {
                union ehci_shadow       here;
-               u32                     type;
+               __le32                  type;
 
                here = ehci->pshadow [frame];
                type = Q_NEXT_TYPE (ehci->periodic [frame]);
@@ -312,12 +312,12 @@ static void intr_deschedule (
 
        do {
                periodic_unlink (ehci, frame, qh);
-               qh_put (ehci, qh);
+               qh_put (qh);
                frame += qh->period;
        } while (frame < ehci->periodic_size);
 
        qh->qh_state = QH_STATE_UNLINK;
-       qh->qh_next.ptr = 0;
+       qh->qh_next.ptr = NULL;
        ehci->periodic_sched--;
 
        /* maybe turn off periodic schedule */
@@ -355,7 +355,7 @@ static void intr_deschedule (
 
        dbg ("descheduled qh %p, period = %d frame = %d count = %d, urbs = %d",
                qh, qh->period, frame,
-               atomic_read (&qh->refcount), ehci->periodic_sched);
+               atomic_read (&qh->kref.refcount), ehci->periodic_sched);
 }
 
 static int check_period (
@@ -403,7 +403,7 @@ static int check_intr_schedule (
        unsigned                frame,
        unsigned                uframe,
        const struct ehci_qh    *qh,
-       u32                     *c_maskp
+       __le32                  *c_maskp
 )
 {
        int             retval = -ENOSPC;
@@ -412,7 +412,7 @@ static int check_intr_schedule (
                goto done;
        if (!qh->c_usecs) {
                retval = 0;
-               *c_maskp = cpu_to_le32 (0);
+               *c_maskp = 0;
                goto done;
        }
 
@@ -447,7 +447,7 @@ static int qh_schedule (struct ehci_hcd *ehci, struct ehci_qh *qh)
 {
        int             status;
        unsigned        uframe;
-       u32             c_mask;
+       __le32          c_mask;
        unsigned        frame;          /* 0..(qh->period - 1), or NO_FRAME */
 
        qh->hw_next = EHCI_LIST_END;
@@ -483,7 +483,7 @@ static int qh_schedule (struct ehci_hcd *ehci, struct ehci_qh *qh)
                qh->start = frame;
 
                /* reset S-frame and (maybe) C-frame masks */
-               qh->hw_info2 &= ~0xffff;
+               qh->hw_info2 &= ~__constant_cpu_to_le32(0xffff);
                qh->hw_info2 |= cpu_to_le32 (1 << uframe) | c_mask;
        } else
                dbg ("reused previous qh %p schedule", qh);
@@ -718,7 +718,7 @@ iso_stream_put(struct ehci_hcd *ehci, struct ehci_iso_stream *stream)
 
                is_in = (stream->bEndpointAddress & USB_DIR_IN) ? 0x10 : 0;
                stream->bEndpointAddress &= 0x0f;
-               dev->ep [is_in + stream->bEndpointAddress] = 0;
+               dev->ep[is_in + stream->bEndpointAddress] = NULL;
 
                if (stream->rescheduled) {
                        ehci_info (ehci, "ep%d%s-iso rescheduled "
@@ -772,7 +772,7 @@ iso_stream_find (struct ehci_hcd *ehci, struct urb *urb)
                ehci_dbg (ehci, "dev %s ep%d%s, not iso??\n",
                        urb->dev->devpath, epnum & 0x0f,
                        (epnum & 0x10) ? "in" : "out");
-               stream = 0;
+               stream = NULL;
        }
 
        /* caller guarantees an eventual matching iso_stream_put */
@@ -896,7 +896,7 @@ itd_urb_transaction (
                        list_del (&itd->itd_list);
                        itd_dma = itd->itd_dma;
                } else
-                       itd = 0;
+                       itd = NULL;
 
                if (!itd) {
                        spin_unlock_irqrestore (&ehci->lock, flags);
@@ -1008,8 +1008,7 @@ sitd_slot_ok (
                uframe += period_uframes;
        } while (uframe < mod);
 
-       stream->splits = stream->raw_mask << (uframe & 7);
-       cpu_to_le32s (&stream->splits);
+       stream->splits = cpu_to_le32(stream->raw_mask << (uframe & 7));
        return 1;
 }
 
@@ -1116,7 +1115,7 @@ iso_stream_schedule (
 
 fail:
        iso_sched_free (stream, sched);
-       urb->hcpriv = 0;
+       urb->hcpriv = NULL;
        return status;
 
 ready:
@@ -1215,8 +1214,8 @@ itd_link_urb (
        hcd_to_bus (&ehci->hcd)->bandwidth_isoc_reqs++;
 
        /* fill iTDs uframe by uframe */
-       for (packet = 0, itd = 0; packet < urb->number_of_packets; ) {
-               if (itd == 0) {
+       for (packet = 0, itd = NULL; packet < urb->number_of_packets; ) {
+               if (itd == NULL) {
                        /* ASSERT:  we have all necessary itds */
                        // BUG_ON (list_empty (&iso_sched->td_list));
 
@@ -1247,14 +1246,14 @@ itd_link_urb (
                if (((next_uframe >> 3) != frame)
                                || packet == urb->number_of_packets) {
                        itd_link (ehci, frame % ehci->periodic_size, itd);
-                       itd = 0;
+                       itd = NULL;
                }
        }
        stream->next_uframe = next_uframe;
 
        /* don't need that schedule data any more */
        iso_sched_free (stream, iso_sched);
-       urb->hcpriv = 0;
+       urb->hcpriv = NULL;
 
        timer_action (ehci, TIMER_IO_WATCHDOG);
        if (unlikely (!ehci->periodic_sched++))
@@ -1311,8 +1310,8 @@ itd_complete (
        }
 
        usb_put_urb (urb);
-       itd->urb = 0;
-       itd->stream = 0;
+       itd->urb = NULL;
+       itd->stream = NULL;
        list_move (&itd->itd_list, &stream->free_list);
        iso_stream_put (ehci, stream);
 
@@ -1328,7 +1327,7 @@ itd_complete (
        /* give urb back to the driver ... can be out-of-order */
        dev = usb_get_dev (urb->dev);
        ehci_urb_done (ehci, urb, regs);
-       urb = 0;
+       urb = NULL;
 
        /* defer stopping schedule; completion can submit */
        ehci->periodic_sched--;
@@ -1499,7 +1498,7 @@ sitd_urb_transaction (
                        list_del (&sitd->sitd_list);
                        sitd_dma = sitd->sitd_dma;
                } else
-                       sitd = 0;
+                       sitd = NULL;
 
                if (!sitd) {
                        spin_unlock_irqrestore (&ehci->lock, flags);
@@ -1600,7 +1599,7 @@ sitd_link_urb (
        hcd_to_bus (&ehci->hcd)->bandwidth_isoc_reqs++;
 
        /* fill sITDs frame by frame */
-       for (packet = 0, sitd = 0;
+       for (packet = 0, sitd = NULL;
                        packet < urb->number_of_packets;
                        packet++) {
 
@@ -1626,7 +1625,7 @@ sitd_link_urb (
 
        /* don't need that schedule data any more */
        iso_sched_free (stream, sched);
-       urb->hcpriv = 0;
+       urb->hcpriv = NULL;
 
        timer_action (ehci, TIMER_IO_WATCHDOG);
        if (!ehci->periodic_sched++)
@@ -1673,8 +1672,8 @@ sitd_complete (
        }
 
        usb_put_urb (urb);
-       sitd->urb = 0;
-       sitd->stream = 0;
+       sitd->urb = NULL;
+       sitd->stream = NULL;
        list_move (&sitd->sitd_list, &stream->free_list);
        stream->depth -= stream->interval << 3;
        iso_stream_put (ehci, stream);
@@ -1691,7 +1690,7 @@ sitd_complete (
        /* give urb back to the driver */
        dev = usb_get_dev (urb->dev);
        ehci_urb_done (ehci, urb, regs);
-       urb = 0;
+       urb = NULL;
 
        /* defer stopping schedule; completion can submit */
        ehci->periodic_sched--;
@@ -1812,7 +1811,7 @@ scan_periodic (struct ehci_hcd *ehci, struct pt_regs *regs)
 
        for (;;) {
                union ehci_shadow       q, *q_p;
-               u32                     type, *hw_p;
+               __le32                  type, *hw_p;
                unsigned                uframes;
 
                /* don't scan past the live uframe */
@@ -1846,7 +1845,7 @@ restart:
                                modified = qh_completions (ehci, temp.qh, regs);
                                if (unlikely (list_empty (&temp.qh->qtd_list)))
                                        intr_deschedule (ehci, temp.qh, 0);
-                               qh_put (ehci, temp.qh);
+                               qh_put (temp.qh);
                                break;
                        case Q_TYPE_FSTN:
                                /* for "save place" FSTNs, look at QH entries
@@ -1903,7 +1902,7 @@ restart:
                                dbg ("corrupt type %d frame %d shadow %p",
                                        type, frame, q.ptr);
                                // BUG ();
-                               q.ptr = 0;
+                               q.ptr = NULL;
                        }
 
                        /* assume completion callbacks modify the queue */