Commit 91a99b5e authored by Alan Stern's avatar Alan Stern Committed by Greg Kroah-Hartman

USB: EHCI: use consistent NO_FRAME value

ehci-hcd is inconsistent in the sentinel values it uses to indicate
that no frame number has been assigned for a periodic transfer.  Some
places it uses NO_FRAME (defined as 65535), other places it uses -1,
and elsewhere it uses 9999.

This patch defines a value for NO_FRAME which can fit in a 16-bit
signed integer, and changes the code to use it everywhere.
Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 27c4a31d
...@@ -813,7 +813,7 @@ static int qh_schedule(struct ehci_hcd *ehci, struct ehci_qh *qh) ...@@ -813,7 +813,7 @@ static int qh_schedule(struct ehci_hcd *ehci, struct ehci_qh *qh)
frame = qh->start; frame = qh->start;
/* reuse the previous schedule slots, if we can */ /* reuse the previous schedule slots, if we can */
if (frame < qh->period) { if (frame != NO_FRAME) {
uframe = ffs(hc32_to_cpup(ehci, &hw->hw_info2) & QH_SMASK); uframe = ffs(hc32_to_cpup(ehci, &hw->hw_info2) & QH_SMASK);
status = check_intr_schedule (ehci, frame, --uframe, status = check_intr_schedule (ehci, frame, --uframe,
qh, &c_mask); qh, &c_mask);
...@@ -969,7 +969,7 @@ iso_stream_alloc (gfp_t mem_flags) ...@@ -969,7 +969,7 @@ iso_stream_alloc (gfp_t mem_flags)
if (likely (stream != NULL)) { if (likely (stream != NULL)) {
INIT_LIST_HEAD(&stream->td_list); INIT_LIST_HEAD(&stream->td_list);
INIT_LIST_HEAD(&stream->free_list); INIT_LIST_HEAD(&stream->free_list);
stream->next_uframe = -1; stream->next_uframe = NO_FRAME;
} }
return stream; return stream;
} }
...@@ -1236,7 +1236,7 @@ itd_urb_transaction ( ...@@ -1236,7 +1236,7 @@ itd_urb_transaction (
memset (itd, 0, sizeof *itd); memset (itd, 0, sizeof *itd);
itd->itd_dma = itd_dma; itd->itd_dma = itd_dma;
itd->frame = 9999; /* an invalid value */ itd->frame = NO_FRAME;
list_add (&itd->itd_list, &sched->td_list); list_add (&itd->itd_list, &sched->td_list);
} }
spin_unlock_irqrestore (&ehci->lock, flags); spin_unlock_irqrestore (&ehci->lock, flags);
...@@ -1967,7 +1967,7 @@ sitd_urb_transaction ( ...@@ -1967,7 +1967,7 @@ sitd_urb_transaction (
memset (sitd, 0, sizeof *sitd); memset (sitd, 0, sizeof *sitd);
sitd->sitd_dma = sitd_dma; sitd->sitd_dma = sitd_dma;
sitd->frame = 9999; /* an invalid value */ sitd->frame = NO_FRAME;
list_add (&sitd->sitd_list, &iso_sched->td_list); list_add (&sitd->sitd_list, &iso_sched->td_list);
} }
......
...@@ -54,6 +54,8 @@ struct ehci_stats { ...@@ -54,6 +54,8 @@ struct ehci_stats {
unsigned long unlink; unsigned long unlink;
}; };
#define NO_FRAME 29999 /* frame not assigned yet */
/* ehci_hcd->lock guards shared data against other CPUs: /* ehci_hcd->lock guards shared data against other CPUs:
* ehci_hcd: async, unlink, periodic (and shadow), ... * ehci_hcd: async, unlink, periodic (and shadow), ...
* usb_host_endpoint: hcpriv * usb_host_endpoint: hcpriv
...@@ -405,7 +407,6 @@ struct ehci_qh { ...@@ -405,7 +407,6 @@ struct ehci_qh {
u16 tt_usecs; /* tt downstream bandwidth */ u16 tt_usecs; /* tt downstream bandwidth */
unsigned short period; /* polling interval */ unsigned short period; /* polling interval */
unsigned short start; /* where polling starts */ unsigned short start; /* where polling starts */
#define NO_FRAME ((unsigned short)~0) /* pick new start */
struct usb_device *dev; /* access to TT */ struct usb_device *dev; /* access to TT */
unsigned is_out:1; /* bulk or intr OUT */ unsigned is_out:1; /* bulk or intr OUT */
...@@ -454,7 +455,7 @@ struct ehci_iso_stream { ...@@ -454,7 +455,7 @@ struct ehci_iso_stream {
struct usb_host_endpoint *ep; struct usb_host_endpoint *ep;
/* output of (re)scheduling */ /* output of (re)scheduling */
int next_uframe; unsigned next_uframe;
__hc32 splits; __hc32 splits;
/* the rest is derived from the endpoint descriptor, /* the rest is derived from the endpoint descriptor,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment