diff options
| author | Alan Stern <stern@rowland.harvard.edu> | 2013-10-11 11:28:52 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-10-11 19:40:26 -0400 |
| commit | 91a99b5e78849db90dc2f5e8dfa034af43bdb760 (patch) | |
| tree | 27af7c91347333591d6e47e043072400ea55f74b | |
| parent | 27c4a31d6739095d613c6e72fb44867bc28c699f (diff) | |
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: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| -rw-r--r-- | drivers/usb/host/ehci-sched.c | 8 | ||||
| -rw-r--r-- | drivers/usb/host/ehci.h | 5 |
2 files changed, 7 insertions, 6 deletions
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c index 1fc2befc4fdc..37e97a70894a 100644 --- a/drivers/usb/host/ehci-sched.c +++ b/drivers/usb/host/ehci-sched.c | |||
| @@ -813,7 +813,7 @@ static int qh_schedule(struct ehci_hcd *ehci, struct ehci_qh *qh) | |||
| 813 | frame = qh->start; | 813 | frame = qh->start; |
| 814 | 814 | ||
| 815 | /* reuse the previous schedule slots, if we can */ | 815 | /* reuse the previous schedule slots, if we can */ |
| 816 | if (frame < qh->period) { | 816 | if (frame != NO_FRAME) { |
| 817 | uframe = ffs(hc32_to_cpup(ehci, &hw->hw_info2) & QH_SMASK); | 817 | uframe = ffs(hc32_to_cpup(ehci, &hw->hw_info2) & QH_SMASK); |
| 818 | status = check_intr_schedule (ehci, frame, --uframe, | 818 | status = check_intr_schedule (ehci, frame, --uframe, |
| 819 | qh, &c_mask); | 819 | qh, &c_mask); |
| @@ -969,7 +969,7 @@ iso_stream_alloc (gfp_t mem_flags) | |||
| 969 | if (likely (stream != NULL)) { | 969 | if (likely (stream != NULL)) { |
| 970 | INIT_LIST_HEAD(&stream->td_list); | 970 | INIT_LIST_HEAD(&stream->td_list); |
| 971 | INIT_LIST_HEAD(&stream->free_list); | 971 | INIT_LIST_HEAD(&stream->free_list); |
| 972 | stream->next_uframe = -1; | 972 | stream->next_uframe = NO_FRAME; |
| 973 | } | 973 | } |
| 974 | return stream; | 974 | return stream; |
| 975 | } | 975 | } |
| @@ -1236,7 +1236,7 @@ itd_urb_transaction ( | |||
| 1236 | 1236 | ||
| 1237 | memset (itd, 0, sizeof *itd); | 1237 | memset (itd, 0, sizeof *itd); |
| 1238 | itd->itd_dma = itd_dma; | 1238 | itd->itd_dma = itd_dma; |
| 1239 | itd->frame = 9999; /* an invalid value */ | 1239 | itd->frame = NO_FRAME; |
| 1240 | list_add (&itd->itd_list, &sched->td_list); | 1240 | list_add (&itd->itd_list, &sched->td_list); |
| 1241 | } | 1241 | } |
| 1242 | spin_unlock_irqrestore (&ehci->lock, flags); | 1242 | spin_unlock_irqrestore (&ehci->lock, flags); |
| @@ -1967,7 +1967,7 @@ sitd_urb_transaction ( | |||
| 1967 | 1967 | ||
| 1968 | memset (sitd, 0, sizeof *sitd); | 1968 | memset (sitd, 0, sizeof *sitd); |
| 1969 | sitd->sitd_dma = sitd_dma; | 1969 | sitd->sitd_dma = sitd_dma; |
| 1970 | sitd->frame = 9999; /* an invalid value */ | 1970 | sitd->frame = NO_FRAME; |
| 1971 | list_add (&sitd->sitd_list, &iso_sched->td_list); | 1971 | list_add (&sitd->sitd_list, &iso_sched->td_list); |
| 1972 | } | 1972 | } |
| 1973 | 1973 | ||
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h index 2d401927e143..b93eb59bb529 100644 --- a/drivers/usb/host/ehci.h +++ b/drivers/usb/host/ehci.h | |||
| @@ -54,6 +54,8 @@ struct ehci_stats { | |||
| 54 | unsigned long unlink; | 54 | unsigned long unlink; |
| 55 | }; | 55 | }; |
| 56 | 56 | ||
| 57 | #define NO_FRAME 29999 /* frame not assigned yet */ | ||
| 58 | |||
| 57 | /* ehci_hcd->lock guards shared data against other CPUs: | 59 | /* ehci_hcd->lock guards shared data against other CPUs: |
| 58 | * ehci_hcd: async, unlink, periodic (and shadow), ... | 60 | * ehci_hcd: async, unlink, periodic (and shadow), ... |
| 59 | * usb_host_endpoint: hcpriv | 61 | * usb_host_endpoint: hcpriv |
| @@ -405,7 +407,6 @@ struct ehci_qh { | |||
| 405 | u16 tt_usecs; /* tt downstream bandwidth */ | 407 | u16 tt_usecs; /* tt downstream bandwidth */ |
| 406 | unsigned short period; /* polling interval */ | 408 | unsigned short period; /* polling interval */ |
| 407 | unsigned short start; /* where polling starts */ | 409 | unsigned short start; /* where polling starts */ |
| 408 | #define NO_FRAME ((unsigned short)~0) /* pick new start */ | ||
| 409 | 410 | ||
| 410 | struct usb_device *dev; /* access to TT */ | 411 | struct usb_device *dev; /* access to TT */ |
| 411 | unsigned is_out:1; /* bulk or intr OUT */ | 412 | unsigned is_out:1; /* bulk or intr OUT */ |
| @@ -454,7 +455,7 @@ struct ehci_iso_stream { | |||
| 454 | struct usb_host_endpoint *ep; | 455 | struct usb_host_endpoint *ep; |
| 455 | 456 | ||
| 456 | /* output of (re)scheduling */ | 457 | /* output of (re)scheduling */ |
| 457 | int next_uframe; | 458 | unsigned next_uframe; |
| 458 | __hc32 splits; | 459 | __hc32 splits; |
| 459 | 460 | ||
| 460 | /* the rest is derived from the endpoint descriptor, | 461 | /* the rest is derived from the endpoint descriptor, |
