Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 515bb8b2 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "usb: dwc3: Give unique name to gsi endpoints"

parents 2c01e8d0 05ad9ba3
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -2617,10 +2617,12 @@ static int dwc3_gadget_init_endpoints(struct dwc3 *dwc, u8 total)

		/* Reserve EPs at the end for GSI */
		if (!direction && num > out_count - NUM_GSI_OUT_EPS - 1) {
			snprintf(dep->name, sizeof(dep->name), "gsi-epout");
			snprintf(dep->name, sizeof(dep->name), "gsi-epout%d",
					num);
			dep->endpoint.ep_type = EP_TYPE_GSI;
		} else if (direction && num > in_count - NUM_GSI_IN_EPS - 1) {
			snprintf(dep->name, sizeof(dep->name), "gsi-epin");
			snprintf(dep->name, sizeof(dep->name), "gsi-epin%d",
					num);
			dep->endpoint.ep_type = EP_TYPE_GSI;
		} else {
			snprintf(dep->name, sizeof(dep->name), "ep%u%s", num,
+7 −2
Original line number Diff line number Diff line
@@ -211,7 +211,7 @@ void usb_ep_autoconfig_reset (struct usb_gadget *gadget)
EXPORT_SYMBOL_GPL(usb_ep_autoconfig_reset);

/**
 * usb_ep_autoconfig_by_name - Used to pick the endpoint by name. eg ep1in-gsi
 * 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.
@@ -227,8 +227,12 @@ struct usb_ep *usb_ep_autoconfig_by_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 (strcmp(ep->name, ep_name) == 0 && !ep->driver_data) {
		if (strncmp(ep->name, ep_name, strlen(ep_name)) == 0 &&
				!ep->driver_data) {
			ep_found = true;
			break;
		}
@@ -243,6 +247,7 @@ struct usb_ep *usb_ep_autoconfig_by_name(
		return ep;
	}

err:
	pr_err("%s:error finding ep %s\n", __func__, ep_name);
	return NULL;
}