Skip to content

Commit 99bcfee

Browse files
Felipe Balbinsekhar
authored andcommitted
usb: dwc3: gadget: improve ep_queue's error reporting
We shouldn't return -EBUSY, that's used only internally when the core still has transfers in flight on a given endpoint. Also, combine the error reporting so that we don't have to duplicate it. Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Sekhar Nori <nsekhar@ti.com>
1 parent 7db17c6 commit 99bcfee

File tree

1 file changed

+12
-19
lines changed

1 file changed

+12
-19
lines changed

drivers/usb/dwc3/gadget.c

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,10 +1081,7 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req)
10811081
if (!usb_endpoint_xfer_isoc(dep->endpoint.desc) &&
10821082
!(dep->flags & DWC3_EP_BUSY)) {
10831083
ret = __dwc3_gadget_kick_transfer(dep, 0, true);
1084-
if (ret && ret != -EBUSY)
1085-
dev_dbg(dwc->dev, "%s: failed to kick transfers\n",
1086-
dep->name);
1087-
return ret;
1084+
goto out;
10881085
}
10891086

10901087
/*
@@ -1114,14 +1111,10 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req)
11141111
}
11151112

11161113
ret = __dwc3_gadget_kick_transfer(dep, 0, true);
1117-
if (ret && ret != -EBUSY)
1118-
dev_dbg(dwc->dev, "%s: failed to kick transfers\n",
1119-
dep->name);
1120-
11211114
if (!ret)
11221115
dep->flags &= ~DWC3_EP_PENDING_REQUEST;
11231116

1124-
return ret;
1117+
goto out;
11251118
}
11261119

11271120
/*
@@ -1135,25 +1128,25 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req)
11351128
WARN_ON_ONCE(!dep->resource_index);
11361129
ret = __dwc3_gadget_kick_transfer(dep, dep->resource_index,
11371130
false);
1138-
if (ret && ret != -EBUSY)
1139-
dev_dbg(dwc->dev, "%s: failed to kick transfers\n",
1140-
dep->name);
1141-
return ret;
1131+
goto out;
11421132
}
11431133

11441134
/*
11451135
* 4. Stream Capable Bulk Endpoints. We need to start the transfer
11461136
* right away, otherwise host will not know we have streams to be
11471137
* handled.
11481138
*/
1149-
if (dep->stream_capable) {
1139+
if (dep->stream_capable)
11501140
ret = __dwc3_gadget_kick_transfer(dep, 0, true);
1151-
if (ret && ret != -EBUSY)
1152-
dev_dbg(dwc->dev, "%s: failed to kick transfers\n",
1153-
dep->name);
1154-
}
11551141

1156-
return 0;
1142+
out:
1143+
if (ret && ret != -EBUSY)
1144+
dev_dbg(dwc->dev, "%s: failed to kick transfers\n",
1145+
dep->name);
1146+
if (ret == -EBUSY)
1147+
ret = 0;
1148+
1149+
return ret;
11571150
}
11581151

11591152
static int dwc3_gadget_ep_queue(struct usb_ep *ep, struct usb_request *request,

0 commit comments

Comments
 (0)