usb: dwc3: gadget: defer endpoint name change
We should only change endpoint names when we actually manage to enable/disable it. Signed-off-by: Felipe Balbi <balbi@ti.com>
This commit is contained in:
parent
7eaeac5c0e
commit
aa7399744d
@ -547,6 +547,23 @@ static int __dwc3_gadget_ep_enable(struct dwc3_ep *dep,
|
||||
trb_link->ctrl |= DWC3_TRB_CTRL_HWO;
|
||||
}
|
||||
|
||||
switch (usb_endpoint_type(desc)) {
|
||||
case USB_ENDPOINT_XFER_CONTROL:
|
||||
strlcat(dep->name, "-control", sizeof(dep->name));
|
||||
break;
|
||||
case USB_ENDPOINT_XFER_ISOC:
|
||||
strlcat(dep->name, "-isoc", sizeof(dep->name));
|
||||
break;
|
||||
case USB_ENDPOINT_XFER_BULK:
|
||||
strlcat(dep->name, "-bulk", sizeof(dep->name));
|
||||
break;
|
||||
case USB_ENDPOINT_XFER_INT:
|
||||
strlcat(dep->name, "-int", sizeof(dep->name));
|
||||
break;
|
||||
default:
|
||||
dev_err(dwc->dev, "invalid endpoint transfer type\n");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -604,6 +621,10 @@ static int __dwc3_gadget_ep_disable(struct dwc3_ep *dep)
|
||||
dep->type = 0;
|
||||
dep->flags = 0;
|
||||
|
||||
snprintf(dep->name, sizeof(dep->name), "ep%d%s",
|
||||
dep->number >> 1,
|
||||
(dep->number & 1) ? "in" : "out");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -649,23 +670,6 @@ static int dwc3_gadget_ep_enable(struct usb_ep *ep,
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch (usb_endpoint_type(desc)) {
|
||||
case USB_ENDPOINT_XFER_CONTROL:
|
||||
strlcat(dep->name, "-control", sizeof(dep->name));
|
||||
break;
|
||||
case USB_ENDPOINT_XFER_ISOC:
|
||||
strlcat(dep->name, "-isoc", sizeof(dep->name));
|
||||
break;
|
||||
case USB_ENDPOINT_XFER_BULK:
|
||||
strlcat(dep->name, "-bulk", sizeof(dep->name));
|
||||
break;
|
||||
case USB_ENDPOINT_XFER_INT:
|
||||
strlcat(dep->name, "-int", sizeof(dep->name));
|
||||
break;
|
||||
default:
|
||||
dev_err(dwc->dev, "invalid endpoint transfer type\n");
|
||||
}
|
||||
|
||||
spin_lock_irqsave(&dwc->lock, flags);
|
||||
ret = __dwc3_gadget_ep_enable(dep, desc, ep->comp_desc, false, false);
|
||||
spin_unlock_irqrestore(&dwc->lock, flags);
|
||||
@ -694,10 +698,6 @@ static int dwc3_gadget_ep_disable(struct usb_ep *ep)
|
||||
return 0;
|
||||
}
|
||||
|
||||
snprintf(dep->name, sizeof(dep->name), "ep%d%s",
|
||||
dep->number >> 1,
|
||||
(dep->number & 1) ? "in" : "out");
|
||||
|
||||
spin_lock_irqsave(&dwc->lock, flags);
|
||||
ret = __dwc3_gadget_ep_disable(dep);
|
||||
spin_unlock_irqrestore(&dwc->lock, flags);
|
||||
|
Loading…
Reference in New Issue
Block a user