From 95099d4622f8cb224d94e314c7a8e0df60b13f87 Mon Sep 17 00:00:00 2001
From: hc <hc@nodka.com>
Date: Sat, 09 Dec 2023 08:38:01 +0000
Subject: [PATCH] enable docker ppp
---
kernel/drivers/usb/gadget/epautoconf.c | 105 ++++++++++++----------------------------------------
1 files changed, 24 insertions(+), 81 deletions(-)
diff --git a/kernel/drivers/usb/gadget/epautoconf.c b/kernel/drivers/usb/gadget/epautoconf.c
index c80f9ba..1eb4fa2 100644
--- a/kernel/drivers/usb/gadget/epautoconf.c
+++ b/kernel/drivers/usb/gadget/epautoconf.c
@@ -67,9 +67,6 @@
)
{
struct usb_ep *ep;
- u8 type;
-
- type = desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK;
if (gadget->ops->match_ep) {
ep = gadget->ops->match_ep(gadget, desc, ep_comp);
@@ -109,41 +106,10 @@
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->desc = NULL;
ep->comp_desc = NULL;
ep->claimed = true;
-#ifdef CONFIG_ARCH_ROCKCHIP
- ep->transfer_type = type;
- if (gadget_is_superspeed(gadget) && ep_comp) {
- switch (type) {
- case USB_ENDPOINT_XFER_ISOC:
- /* mult: bits 1:0 of bmAttributes */
- ep->mult = (ep_comp->bmAttributes & 0x3) + 1;
- /* fall through */
- case USB_ENDPOINT_XFER_BULK:
- case USB_ENDPOINT_XFER_INT:
- ep->maxburst = ep_comp->bMaxBurst + 1;
- break;
- default:
- break;
- }
- } else if (gadget_is_dualspeed(gadget) &&
- (type == USB_ENDPOINT_XFER_ISOC ||
- type == USB_ENDPOINT_XFER_INT)) {
- ep->mult = usb_endpoint_maxp_mult(desc);
- }
-#endif
return ep;
}
EXPORT_SYMBOL_GPL(usb_ep_autoconfig_ss);
@@ -173,9 +139,10 @@
*
* On success, this returns an claimed usb_ep, and modifies the endpoint
* descriptor bEndpointAddress. For bulk endpoints, the wMaxPacket value
- * is initialized as if the endpoint were used at full speed. To prevent
- * the endpoint from being returned by a later autoconfig call, claims it
- * by assigning ep->claimed to true.
+ * is initialized as if the endpoint were used at full speed. Because of
+ * that the users must consider adjusting the autoconfigured descriptor.
+ * 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.
*/
@@ -184,7 +151,26 @@
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);
@@ -226,46 +212,3 @@
gadget->out_epnum = 0;
}
EXPORT_SYMBOL_GPL(usb_ep_autoconfig_reset);
-
-/**
- * usb_ep_autoconfig_by_name - Used to pick the endpoint by name. eg gsi-epin1
- * @gadget: The device to which the endpoint must belong.
- * @desc: Endpoint descriptor, with endpoint direction and transfer mode
- * initialized.
- * @ep_name: EP name that is to be searched.
- *
- */
-struct usb_ep *usb_ep_autoconfig_by_name(
- struct usb_gadget *gadget,
- struct usb_endpoint_descriptor *desc,
- const char *ep_name
-)
-{
- struct usb_ep *ep;
- bool ep_found = false;
-
- if (!ep_name || !strlen(ep_name))
- goto err;
-
- list_for_each_entry(ep, &gadget->ep_list, ep_list)
- if (strncmp(ep->name, ep_name, strlen(ep_name)) == 0 &&
- !ep->driver_data) {
- ep_found = true;
- break;
- }
-
- if (ep_found) {
- desc->bEndpointAddress &= USB_DIR_IN;
- desc->bEndpointAddress |= ep->ep_num;
- ep->address = desc->bEndpointAddress;
- pr_debug("Allocating ep address:%x\n", ep->address);
- ep->desc = NULL;
- ep->comp_desc = NULL;
- return ep;
- }
-
-err:
- pr_err("%s:error finding ep %s\n", __func__, ep_name);
- return NULL;
-}
-EXPORT_SYMBOL_GPL(usb_ep_autoconfig_by_name);
--
Gitblit v1.6.2