summaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2018-12-07 10:09:32 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2018-12-07 11:08:33 +0100
commit49f802cc097d7086dab6705f086e575b46e8f3df (patch)
tree4c074b67ec8ece155e1e12ba6fd3e1d5d1f646fe /drivers/usb/gadget
parente1552e24d0bb4dfdc29e9d1238a6d87c68638ea3 (diff)
downloadbarebox-49f802cc097d7086dab6705f086e575b46e8f3df.tar.gz
barebox-49f802cc097d7086dab6705f086e575b46e8f3df.tar.xz
usb: gadget: fastboot: drop unnecessary global variable
Polling for the status of a request does not require a global variable. We can poll for the status directly. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r--drivers/usb/gadget/f_fastboot.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index a5b2564814..61cc0b2e62 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -182,15 +182,8 @@ static struct usb_gadget_strings *fastboot_strings[] = {
static void rx_handler_command(struct usb_ep *ep, struct usb_request *req);
-static int in_req_complete;
-
static void fastboot_complete(struct usb_ep *ep, struct usb_request *req)
{
- int status = req->status;
-
- in_req_complete = 1;
-
- pr_debug("status: %d ep '%s' trans: %d\n", status, ep->name, req->actual);
}
static struct usb_request *fastboot_alloc_request(struct usb_ep *ep)
@@ -540,19 +533,22 @@ static int fastboot_tx_write(struct f_fastboot *f_fb, const char *buffer, unsign
memcpy(in_req->buf, buffer, buffer_size);
in_req->length = buffer_size;
- in_req_complete = 0;
+
ret = usb_ep_queue(f_fb->in_ep, in_req);
if (ret)
pr_err("Error %d on queue\n", ret);
start = get_time_ns();
- while (!in_req_complete) {
+ while (in_req->status == -EINPROGRESS) {
if (is_timeout(start, 2 * SECOND))
return -ETIMEDOUT;
usb_gadget_poll();
}
+ if (in_req->status)
+ pr_err("Failed to send answer: %d\n", in_req->status);
+
return 0;
}