aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/usb
diff options
context:
space:
mode:
authorFelipe Balbi <balbi@ti.com>2012-01-02 06:35:41 -0500
committerBrad Figg <brad.figg@canonical.com>2012-01-23 18:36:39 -0500
commit4aee7ee22658020586a10d933b9d75cd71c09925 (patch)
tree53ece0e1947697418cc8e599a43f3a1a824eb32e /include/linux/usb
parent97492e361e25f4529eecc51a6b8b016ace052783 (diff)
usb: ch9: fix up MaxStreams helper
BugLink: http://bugs.launchpad.net/bugs/915926 commit 18b7ede5f7ee2092aedcb578d3ac30bd5d4fc23c upstream. [ removed the dwc3 portion of the patch as it didn't apply to older kernels - gregkh] According to USB 3.0 Specification Table 9-22, if bmAttributes [4:0] are set to zero, it means "no streams supported", but the way this helper was defined on Linux, we will *always* have one stream which might cause several problems. For example on DWC3, we would tell the controller endpoint has streams enabled and yet start transfers with Stream ID set to 0, which would goof up the host side. While doing that, convert the macro to an inline function due to the different checks we now need. Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com> Signed-off-by: Brad Figg <brad.figg@canonical.com>
Diffstat (limited to 'include/linux/usb')
-rw-r--r--include/linux/usb/ch9.h20
1 files changed, 19 insertions, 1 deletions
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h
index 0fd3fbdd828..cf65b5cff72 100644
--- a/include/linux/usb/ch9.h
+++ b/include/linux/usb/ch9.h
@@ -583,8 +583,26 @@ struct usb_ss_ep_comp_descriptor {
583} __attribute__ ((packed)); 583} __attribute__ ((packed));
584 584
585#define USB_DT_SS_EP_COMP_SIZE 6 585#define USB_DT_SS_EP_COMP_SIZE 6
586
586/* Bits 4:0 of bmAttributes if this is a bulk endpoint */ 587/* Bits 4:0 of bmAttributes if this is a bulk endpoint */
587#define USB_SS_MAX_STREAMS(p) (1 << ((p) & 0x1f)) 588static inline int
589usb_ss_max_streams(const struct usb_ss_ep_comp_descriptor *comp)
590{
591 int max_streams;
592
593 if (!comp)
594 return 0;
595
596 max_streams = comp->bmAttributes & 0x1f;
597
598 if (!max_streams)
599 return 0;
600
601 max_streams = 1 << max_streams;
602
603 return max_streams;
604}
605
588/* Bits 1:0 of bmAttributes if this is an isoc endpoint */ 606/* Bits 1:0 of bmAttributes if this is an isoc endpoint */
589#define USB_SS_MULT(p) (1 + ((p) & 0x3)) 607#define USB_SS_MULT(p) (1 + ((p) & 0x3))
590 608