usb: dwc3: gadget: Rate limit ep_queue() error message

In case of a soft disconnect the controller will be halted
via dwc3_gadget_run_stop(). However, a function driver might
be unaware of this and could still be continuing to call
usb_ep_queue() in a different process. Since pullups_connected
is false, this results in a dev_err() to be printed and could
happen quite frequently before the function's disconnect or
unbind callbacks are finally notified. Rate limit this error
message to avoid flooding the kernel log.

Change-Id: If5299cdfd7eee13bb51a8cf29917d9674d0a7c9b
Signed-off-by: Jack Pham <jackp@codeaurora.org>
This commit is contained in:
Jack Pham 2020-05-26 22:16:41 -07:00
commit ad718dac47
2 changed files with 2 additions and 2 deletions

View file

@ -199,7 +199,7 @@ int dwc3_gadget_ep0_queue(struct usb_ep *ep, struct usb_request *request,
spin_lock_irqsave(&dwc->lock, flags);
if (!dep->endpoint.desc || !dwc->pullups_connected ||
!dwc->vbus_active) {
dev_err(dwc->dev, "%s: can't queue to disabled endpoint\n",
dev_err_ratelimited(dwc->dev, "%s: can't queue to disabled endpoint\n",
dep->name);
ret = -ESHUTDOWN;
goto out;

View file

@ -1554,7 +1554,7 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req)
struct dwc3 *dwc = dep->dwc;
if (!dep->endpoint.desc || !dwc->pullups_connected) {
dev_err(dwc->dev, "%s: can't queue to disabled endpoint\n",
dev_err_ratelimited(dwc->dev, "%s: can't queue to disabled endpoint\n",
dep->name);
return -ESHUTDOWN;
}