* @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:
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;
/* 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;
}
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;
*/
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]);
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 */
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 (
unsigned frame,
unsigned uframe,
const struct ehci_qh *qh,
- u32 *c_maskp
+ __le32 *c_maskp
)
{
int retval = -ENOSPC;
goto done;
if (!qh->c_usecs) {
retval = 0;
- *c_maskp = cpu_to_le32 (0);
+ *c_maskp = 0;
goto done;
}
{
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;
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);
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 "
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 */
list_del (&itd->itd_list);
itd_dma = itd->itd_dma;
} else
- itd = 0;
+ itd = NULL;
if (!itd) {
spin_unlock_irqrestore (&ehci->lock, flags);
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;
}
fail:
iso_sched_free (stream, sched);
- urb->hcpriv = 0;
+ urb->hcpriv = NULL;
return status;
ready:
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));
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++))
}
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);
/* 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--;
list_del (&sitd->sitd_list);
sitd_dma = sitd->sitd_dma;
} else
- sitd = 0;
+ sitd = NULL;
if (!sitd) {
spin_unlock_irqrestore (&ehci->lock, flags);
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++) {
/* 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++)
}
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);
/* 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--;
for (;;) {
union ehci_shadow q, *q_p;
- u32 type, *hw_p;
+ __le32 type, *hw_p;
unsigned uframes;
/* don't scan past the live uframe */
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
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 */