diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2011-09-19 14:15:45 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2011-09-20 21:12:46 +0200 |
commit | 06031b334257c14578588312f16e7d9ed2abbec7 (patch) | |
tree | 3f257defdbd2d59a3a3f25039cd4c6644b6795b1 /drivers | |
parent | 8026b62dc4f8e0840ec175a60981d3b05345e8ef (diff) | |
download | barebox-06031b334257c14578588312f16e7d9ed2abbec7.tar.gz barebox-06031b334257c14578588312f16e7d9ed2abbec7.tar.xz |
usb: honour timeout fields
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/core/usb.c | 18 | ||||
-rw-r--r-- | drivers/usb/host/ehci-hcd.c | 4 |
2 files changed, 7 insertions, 15 deletions
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index f2c57103d6..a23446ad1b 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c @@ -521,6 +521,7 @@ int usb_control_msg(struct usb_device *dev, unsigned int pipe, void *data, unsigned short size, int timeout) { struct usb_host *host = dev->host; + int ret; if ((timeout == 0) && (!asynch_allowed)) { /* request for a asynch control pipe is not allowed */ @@ -538,18 +539,9 @@ int usb_control_msg(struct usb_device *dev, unsigned int pipe, request, requesttype, value, index, size); dev->status = USB_ST_NOT_PROC; /*not yet processed */ - host->submit_control_msg(dev, pipe, data, size, &setup_packet); - if (timeout == 0) - return (int)size; - - if (dev->status != 0) { - /* - * Let's wait a while for the timeout to elapse. - * It has no real use, but it keeps the interface happy. - */ - wait_ms(timeout); - return -1; - } + ret = host->submit_control_msg(dev, pipe, data, size, &setup_packet, timeout); + if (ret) + return ret; return dev->act_len; } @@ -569,7 +561,7 @@ int usb_bulk_msg(struct usb_device *dev, unsigned int pipe, return -1; dev->status = USB_ST_NOT_PROC; /* not yet processed */ - ret = host->submit_bulk_msg(dev, pipe, data, len); + ret = host->submit_bulk_msg(dev, pipe, data, len, timeout); if (ret) return ret; diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index bc180af47d..81e41d938e 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c @@ -850,7 +850,7 @@ static int ehci_init(struct usb_host *host) static int submit_bulk_msg(struct usb_device *dev, unsigned long pipe, void *buffer, - int length) + int length, int timeout) { if (usb_pipetype(pipe) != PIPE_BULK) { @@ -862,7 +862,7 @@ submit_bulk_msg(struct usb_device *dev, unsigned long pipe, void *buffer, static int submit_control_msg(struct usb_device *dev, unsigned long pipe, void *buffer, - int length, struct devrequest *setup) + int length, struct devrequest *setup, int timeout) { struct usb_host *host = dev->host; struct ehci_priv *ehci = to_ehci(host); |