mirror of https://gitee.com/openkylin/linux.git
usb: gadget: composite: set our req->context to cdev
by doing that we will be able to match our requests against req and os_desc_req and also clear our pending flags from complete callback. Signed-off-by: Felipe Balbi <balbi@ti.com>
This commit is contained in:
parent
6c93b53423
commit
57943716ff
|
@ -1428,6 +1428,7 @@ composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
|
|||
* when we delegate to it.
|
||||
*/
|
||||
req->zero = 0;
|
||||
req->context = cdev;
|
||||
req->complete = composite_setup_complete;
|
||||
req->length = 0;
|
||||
gadget->ep0->driver_data = cdev;
|
||||
|
@ -1624,6 +1625,7 @@ composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
|
|||
int count = 0;
|
||||
|
||||
req = cdev->os_desc_req;
|
||||
req->context = cdev;
|
||||
req->complete = composite_setup_complete;
|
||||
buf = req->buf;
|
||||
os_desc_cfg = cdev->os_desc_config;
|
||||
|
@ -1686,6 +1688,7 @@ composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
|
|||
break;
|
||||
}
|
||||
req->length = value;
|
||||
req->context = cdev;
|
||||
req->zero = value < w_length;
|
||||
value = usb_ep_queue(gadget->ep0, req, GFP_ATOMIC);
|
||||
if (value < 0) {
|
||||
|
@ -1757,6 +1760,7 @@ composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
|
|||
/* respond with data transfer before status phase? */
|
||||
if (value >= 0 && value != USB_GADGET_DELAYED_STATUS) {
|
||||
req->length = value;
|
||||
req->context = cdev;
|
||||
req->zero = value < w_length;
|
||||
value = usb_ep_queue(gadget->ep0, req, GFP_ATOMIC);
|
||||
if (value < 0) {
|
||||
|
@ -1893,6 +1897,7 @@ int composite_dev_prepare(struct usb_composite_driver *composite,
|
|||
goto fail_dev;
|
||||
|
||||
cdev->req->complete = composite_setup_complete;
|
||||
cdev->req->context = cdev;
|
||||
gadget->ep0->driver_data = cdev;
|
||||
|
||||
cdev->driver = composite;
|
||||
|
@ -1937,6 +1942,7 @@ int composite_os_desc_req_prepare(struct usb_composite_dev *cdev,
|
|||
kfree(cdev->os_desc_req);
|
||||
goto end;
|
||||
}
|
||||
cdev->os_desc_req->context = cdev;
|
||||
cdev->os_desc_req->complete = composite_setup_complete;
|
||||
end:
|
||||
return ret;
|
||||
|
@ -2158,6 +2164,7 @@ void usb_composite_setup_continue(struct usb_composite_dev *cdev)
|
|||
} else if (--cdev->delayed_status == 0) {
|
||||
DBG(cdev, "%s: Completing delayed status\n", __func__);
|
||||
req->length = 0;
|
||||
req->context = cdev;
|
||||
value = usb_ep_queue(cdev->gadget->ep0, req, GFP_ATOMIC);
|
||||
if (value < 0) {
|
||||
DBG(cdev, "ep_queue --> %d\n", value);
|
||||
|
|
Loading…
Reference in New Issue