usb: gadget: composite: set our req->context to cdev
authorFelipe Balbi <balbi@ti.com>
Thu, 18 Sep 2014 14:54:54 +0000 (09:54 -0500)
committerFelipe Balbi <balbi@ti.com>
Mon, 3 Nov 2014 16:00:55 +0000 (10:00 -0600)
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>
drivers/usb/gadget/composite.c

index f6a51fddd5b5bbd570d780bd71cc52137f478e66..09602dc902059d9f84c7a841e3adebb2033070a8 100644 (file)
@@ -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 @@ unknown:
                        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 @@ unknown:
                                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 @@ unknown:
        /* 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);