@@ -345,6 +345,7 @@ int cdnsp_ep_enqueue(struct cdnsp_ep *pep, struct cdnsp_request *preq)
{
struct cdnsp_device *pdev = pep->pdev;
struct usb_request *request;
+ u8 direction;
int ret;
if (preq->epnum == 0 && !list_empty(&pep->pending_list)) {
@@ -355,11 +356,14 @@ int cdnsp_ep_enqueue(struct cdnsp_ep *pep, struct cdnsp_request *preq)
request = &preq->request;
request->actual = 0;
request->status = -EINPROGRESS;
- preq->direction = pep->direction;
+
+ direction = usb_endpoint_xfer_control(pep->endpoint.desc) ?
+ pdev->ep0_expect_in : pep->direction;
+ preq->direction = direction;
preq->epnum = pep->number;
preq->td.drbl = 0;
- ret = usb_gadget_map_request_by_dev(pdev->dev, request, pep->direction);
+ ret = usb_gadget_map_request_by_dev(pdev->dev, request, direction);
if (ret) {
trace_cdnsp_request_enqueue_error(preq);
return ret;
@@ -387,8 +391,7 @@ int cdnsp_ep_enqueue(struct cdnsp_ep *pep, struct cdnsp_request *preq)
return 0;
unmap:
- usb_gadget_unmap_request_by_dev(pdev->dev, &preq->request,
- pep->direction);
+ usb_gadget_unmap_request_by_dev(pdev->dev, &preq->request, direction);
list_del(&preq->list);
trace_cdnsp_request_enqueue_error(preq);