From: Wojciech Zajac Date: Wed, 18 Jun 2014 09:54:24 +0000 (+0200) Subject: USBD return value for wrong URB submit X-Git-Tag: v3.3.0~185 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/migration?a=commitdiff_plain;h=7df0836d354ea4de91b8a3acfe39de825a2a6028;p=minix.git USBD return value for wrong URB submit --- diff --git a/drivers/usbd/hcd/hcd_ddekit.c b/drivers/usbd/hcd/hcd_ddekit.c index ed6dcaeff..0606c20df 100755 --- a/drivers/usbd/hcd/hcd_ddekit.c +++ b/drivers/usbd/hcd/hcd_ddekit.c @@ -185,19 +185,27 @@ ddekit_usb_submit_urb(struct ddekit_usb_urb * d_urb) dev = (hcd_device_state *)(d_urb->dev); drv = (hcd_driver_state *)(dev->driver); - /* Remember original URB */ - dev->urb.original_urb = (void *)d_urb; + /* Check for latest URB completion */ + if (NULL == dev->urb.original_urb) { - /* TODO: URB's should be queued somewhere if DDEKit is not changed */ - /* Turn DDEKit URB format to one that is easier to handle by HCD, also - * check if URB is valid */ - hcd_decode_urb(&(dev->urb), d_urb); + /* Remember original URB */ + dev->urb.original_urb = (void *)d_urb; - /* Start handling URB event */ - drv->current_event = HCD_EVENT_URB; - hcd_handle_event(drv); + /* TODO: If multiple URB's have to be queued, this code + * or DDEKit's must be altered accordingly */ + /* Turn DDEKit URB format to one that is easier to + * handle by HCD, also check if URB is valid */ + hcd_decode_urb(&(dev->urb), d_urb); - return EXIT_SUCCESS; + /* Start handling URB event */ + drv->current_event = HCD_EVENT_URB; + hcd_handle_event(drv); + + return EXIT_SUCCESS; + } + + /* Last URB must not have been completed */ + return EXIT_FAILURE; } @@ -286,6 +294,9 @@ hcd_completion_cb(hcd_urb * urb) hcd_encode_urb(urb, d_urb); completion_cb(d_urb->priv); + + /* URB was handled, forget about it */ + urb->original_urb = NULL; }