Commit dffe2d7f authored by Andrzej Pietrasiewicz's avatar Andrzej Pietrasiewicz Committed by Felipe Balbi

usb: gadget: move non-super speed code out of usb_ep_autoconfig_ss()

The moved code refers to non-super speed endpoints only. This patch also
makes the comment stress the fact, that autoconfigured descriptor might
need some adjustments.
Signed-off-by: default avatarAndrzej Pietrasiewicz <andrzej.p@collabora.com>
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
parent 44a9d1b9
...@@ -67,9 +67,6 @@ struct usb_ep *usb_ep_autoconfig_ss( ...@@ -67,9 +67,6 @@ struct usb_ep *usb_ep_autoconfig_ss(
) )
{ {
struct usb_ep *ep; struct usb_ep *ep;
u8 type;
type = desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK;
if (gadget->ops->match_ep) { if (gadget->ops->match_ep) {
ep = gadget->ops->match_ep(gadget, desc, ep_comp); ep = gadget->ops->match_ep(gadget, desc, ep_comp);
...@@ -109,16 +106,6 @@ struct usb_ep *usb_ep_autoconfig_ss( ...@@ -109,16 +106,6 @@ struct usb_ep *usb_ep_autoconfig_ss(
desc->bEndpointAddress |= gadget->out_epnum; desc->bEndpointAddress |= gadget->out_epnum;
} }
/* report (variable) full speed bulk maxpacket */
if ((type == USB_ENDPOINT_XFER_BULK) && !ep_comp) {
int size = ep->maxpacket_limit;
/* min() doesn't work on bitfields with gcc-3.5 */
if (size > 64)
size = 64;
desc->wMaxPacketSize = cpu_to_le16(size);
}
ep->address = desc->bEndpointAddress; ep->address = desc->bEndpointAddress;
ep->desc = NULL; ep->desc = NULL;
ep->comp_desc = NULL; ep->comp_desc = NULL;
...@@ -152,9 +139,10 @@ EXPORT_SYMBOL_GPL(usb_ep_autoconfig_ss); ...@@ -152,9 +139,10 @@ EXPORT_SYMBOL_GPL(usb_ep_autoconfig_ss);
* *
* On success, this returns an claimed usb_ep, and modifies the endpoint * On success, this returns an claimed usb_ep, and modifies the endpoint
* descriptor bEndpointAddress. For bulk endpoints, the wMaxPacket value * descriptor bEndpointAddress. For bulk endpoints, the wMaxPacket value
* is initialized as if the endpoint were used at full speed. To prevent * is initialized as if the endpoint were used at full speed. Because of
* the endpoint from being returned by a later autoconfig call, claims it * that the users must consider adjusting the autoconfigured descriptor.
* by assigning ep->claimed to true. * To prevent the endpoint from being returned by a later autoconfig call,
* claims it by assigning ep->claimed to true.
* *
* On failure, this returns a null endpoint descriptor. * On failure, this returns a null endpoint descriptor.
*/ */
...@@ -163,7 +151,26 @@ struct usb_ep *usb_ep_autoconfig( ...@@ -163,7 +151,26 @@ struct usb_ep *usb_ep_autoconfig(
struct usb_endpoint_descriptor *desc struct usb_endpoint_descriptor *desc
) )
{ {
return usb_ep_autoconfig_ss(gadget, desc, NULL); struct usb_ep *ep;
u8 type;
ep = usb_ep_autoconfig_ss(gadget, desc, NULL);
if (!ep)
return NULL;
type = desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK;
/* report (variable) full speed bulk maxpacket */
if (type == USB_ENDPOINT_XFER_BULK) {
int size = ep->maxpacket_limit;
/* min() doesn't work on bitfields with gcc-3.5 */
if (size > 64)
size = 64;
desc->wMaxPacketSize = cpu_to_le16(size);
}
return ep;
} }
EXPORT_SYMBOL_GPL(usb_ep_autoconfig); EXPORT_SYMBOL_GPL(usb_ep_autoconfig);
......
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