summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorRemy Bohmer <linux@bohmer.net>2010-02-01 19:40:47 +0100
committerRemy Bohmer <linux@bohmer.net>2010-02-03 22:06:59 +0100
commit84d36b30181acfb72f22d1105c15574b30ea2fa1 (patch)
tree79624fb36508753b02ae4b77f7d828921b8dca9d /common
parent6e20e64f5c6deb5b48e40a0cba4877f9170545e0 (diff)
downloadblackbird-obmc-uboot-84d36b30181acfb72f22d1105c15574b30ea2fa1.tar.gz
blackbird-obmc-uboot-84d36b30181acfb72f22d1105c15574b30ea2fa1.zip
USB: usb_control_msg wait for driver ISR to set status.
This patch changes usb_control_msg back to the state prior to commit 48867208444cb2a82e2af9c3249e90b7ed4a1751. The USB driver ISR routine may update the status. Signed-off-by: Daniel Hellstrom <daniel@gaisler.com>
Diffstat (limited to 'common')
-rw-r--r--common/usb.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/common/usb.c b/common/usb.c
index eef4b34a74..10e23de6a4 100644
--- a/common/usb.c
+++ b/common/usb.c
@@ -197,16 +197,21 @@ int usb_control_msg(struct usb_device *dev, unsigned int pipe,
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;
+ /*
+ * Wait for status to update until timeout expires, USB driver
+ * interrupt handler may set the status when the USB operation has
+ * been completed.
+ */
+ while (timeout--) {
+ if (!((volatile unsigned long)dev->status & USB_ST_NOT_PROC))
+ break;
+ wait_ms(1);
}
+ if (dev->status)
+ return -1;
return dev->act_len;
+
}
/*-------------------------------------------------------------------
OpenPOWER on IntegriCloud