aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/core/config.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/core/config.c')
-rw-r--r--drivers/usb/core/config.c36
1 files changed, 19 insertions, 17 deletions
diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c
index 7103758bb486..24dfb33f90cb 100644
--- a/drivers/usb/core/config.c
+++ b/drivers/usb/core/config.c
@@ -69,30 +69,31 @@ static int find_next_descriptor(unsigned char *buffer, int size,
69 return buffer - buffer0; 69 return buffer - buffer0;
70} 70}
71 71
72static int usb_parse_endpoint_companion(struct device *ddev, int cfgno, 72static int usb_parse_ss_endpoint_companion(struct device *ddev, int cfgno,
73 int inum, int asnum, struct usb_host_endpoint *ep, 73 int inum, int asnum, struct usb_host_endpoint *ep,
74 int num_ep, unsigned char *buffer, int size) 74 int num_ep, unsigned char *buffer, int size)
75{ 75{
76 unsigned char *buffer_start = buffer; 76 unsigned char *buffer_start = buffer;
77 struct usb_ep_comp_descriptor *desc; 77 struct usb_ss_ep_comp_descriptor *desc;
78 int retval; 78 int retval;
79 int num_skipped; 79 int num_skipped;
80 int max_tx; 80 int max_tx;
81 int i; 81 int i;
82 82
83 /* Allocate space for the companion descriptor */ 83 /* Allocate space for the SS endpoint companion descriptor */
84 ep->ep_comp = kzalloc(sizeof(struct usb_host_ep_comp), GFP_KERNEL); 84 ep->ss_ep_comp = kzalloc(sizeof(struct usb_host_ss_ep_comp),
85 if (!ep->ep_comp) 85 GFP_KERNEL);
86 if (!ep->ss_ep_comp)
86 return -ENOMEM; 87 return -ENOMEM;
87 desc = (struct usb_ep_comp_descriptor *) buffer; 88 desc = (struct usb_ss_ep_comp_descriptor *) buffer;
88 if (desc->bDescriptorType != USB_DT_SS_ENDPOINT_COMP) { 89 if (desc->bDescriptorType != USB_DT_SS_ENDPOINT_COMP) {
89 dev_warn(ddev, "No SuperSpeed endpoint companion for config %d " 90 dev_warn(ddev, "No SuperSpeed endpoint companion for config %d "
90 " interface %d altsetting %d ep %d: " 91 " interface %d altsetting %d ep %d: "
91 "using minimum values\n", 92 "using minimum values\n",
92 cfgno, inum, asnum, ep->desc.bEndpointAddress); 93 cfgno, inum, asnum, ep->desc.bEndpointAddress);
93 ep->ep_comp->desc.bLength = USB_DT_EP_COMP_SIZE; 94 ep->ss_ep_comp->desc.bLength = USB_DT_SS_EP_COMP_SIZE;
94 ep->ep_comp->desc.bDescriptorType = USB_DT_SS_ENDPOINT_COMP; 95 ep->ss_ep_comp->desc.bDescriptorType = USB_DT_SS_ENDPOINT_COMP;
95 ep->ep_comp->desc.bMaxBurst = 0; 96 ep->ss_ep_comp->desc.bMaxBurst = 0;
96 /* 97 /*
97 * Leave bmAttributes as zero, which will mean no streams for 98 * Leave bmAttributes as zero, which will mean no streams for
98 * bulk, and isoc won't support multiple bursts of packets. 99 * bulk, and isoc won't support multiple bursts of packets.
@@ -102,7 +103,7 @@ static int usb_parse_endpoint_companion(struct device *ddev, int cfgno,
102 */ 103 */
103 if (usb_endpoint_xfer_isoc(&ep->desc) || 104 if (usb_endpoint_xfer_isoc(&ep->desc) ||
104 usb_endpoint_xfer_int(&ep->desc)) 105 usb_endpoint_xfer_int(&ep->desc))
105 ep->ep_comp->desc.wBytesPerInterval = 106 ep->ss_ep_comp->desc.wBytesPerInterval =
106 ep->desc.wMaxPacketSize; 107 ep->desc.wMaxPacketSize;
107 /* 108 /*
108 * The next descriptor is for an Endpoint or Interface, 109 * The next descriptor is for an Endpoint or Interface,
@@ -112,16 +113,16 @@ static int usb_parse_endpoint_companion(struct device *ddev, int cfgno,
112 retval = 0; 113 retval = 0;
113 goto valid; 114 goto valid;
114 } 115 }
115 memcpy(&ep->ep_comp->desc, desc, USB_DT_EP_COMP_SIZE); 116 memcpy(&ep->ss_ep_comp->desc, desc, USB_DT_SS_EP_COMP_SIZE);
116 desc = &ep->ep_comp->desc; 117 desc = &ep->ss_ep_comp->desc;
117 buffer += desc->bLength; 118 buffer += desc->bLength;
118 size -= desc->bLength; 119 size -= desc->bLength;
119 120
120 /* Eat up the other descriptors we don't care about */ 121 /* Eat up the other descriptors we don't care about */
121 ep->ep_comp->extra = buffer; 122 ep->ss_ep_comp->extra = buffer;
122 i = find_next_descriptor(buffer, size, USB_DT_ENDPOINT, 123 i = find_next_descriptor(buffer, size, USB_DT_ENDPOINT,
123 USB_DT_INTERFACE, &num_skipped); 124 USB_DT_INTERFACE, &num_skipped);
124 ep->ep_comp->extralen = i; 125 ep->ss_ep_comp->extralen = i;
125 buffer += i; 126 buffer += i;
126 size -= i; 127 size -= i;
127 retval = buffer - buffer_start + i; 128 retval = buffer - buffer_start + i;
@@ -310,7 +311,7 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum,
310 cfgno, inum, asnum, d->bEndpointAddress, 311 cfgno, inum, asnum, d->bEndpointAddress,
311 maxp); 312 maxp);
312 } 313 }
313 /* Allocate room for and parse any endpoint companion descriptors */ 314 /* Allocate room for and parse any SS endpoint companion descriptors */
314 if (to_usb_device(ddev)->speed == USB_SPEED_SUPER) { 315 if (to_usb_device(ddev)->speed == USB_SPEED_SUPER) {
315 endpoint->extra = buffer; 316 endpoint->extra = buffer;
316 i = find_next_descriptor_more(buffer, size, USB_DT_SS_ENDPOINT_COMP, 317 i = find_next_descriptor_more(buffer, size, USB_DT_SS_ENDPOINT_COMP,
@@ -320,8 +321,9 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum,
320 size -= i; 321 size -= i;
321 322
322 if (size > 0) { 323 if (size > 0) {
323 retval = usb_parse_endpoint_companion(ddev, cfgno, inum, asnum, 324 retval = usb_parse_ss_endpoint_companion(ddev, cfgno,
324 endpoint, num_ep, buffer, size); 325 inum, asnum, endpoint, num_ep, buffer,
326 size);
325 if (retval >= 0) { 327 if (retval >= 0) {
326 buffer += retval; 328 buffer += retval;
327 retval = buffer - buffer0; 329 retval = buffer - buffer0;