summaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/function/f_uvc.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2014-09-08 11:18:14 +0300
committerFelipe Balbi <balbi@ti.com>2014-09-08 08:49:28 -0500
commit26a029f2277bf58c72ada0a92ae44ff9dd702a2e (patch)
tree7f46c2b62a1be43c631bf31d5b4a4af301a6cdcf /drivers/usb/gadget/function/f_uvc.c
parentb854100eda59a1df9eaf7454cc7c297910055f42 (diff)
downloadlinux-26a029f2277bf58c72ada0a92ae44ff9dd702a2e.tar.bz2
usb: gadget: f_uvc: Store EP0 control request state during setup stage
To handle class requests received on ep0, the driver needs to access the length and direction of the request after the setup stage. It currently stores them in a v4l2 event during the setup stage, and then copies them from the event structure to the driver internal state structure when the event is dequeued. This two-steps approach isn't necessary. Simplify the driver by storing the needed information in the driver internal state structure directly during the setup stage. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget/function/f_uvc.c')
-rw-r--r--drivers/usb/gadget/function/f_uvc.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/usb/gadget/function/f_uvc.c b/drivers/usb/gadget/function/f_uvc.c
index ff4340a1b4b3..e9d625b35751 100644
--- a/drivers/usb/gadget/function/f_uvc.c
+++ b/drivers/usb/gadget/function/f_uvc.c
@@ -251,6 +251,12 @@ uvc_function_setup(struct usb_function *f, const struct usb_ctrlrequest *ctrl)
if (le16_to_cpu(ctrl->wLength) > UVC_MAX_REQUEST_SIZE)
return -EINVAL;
+ /* Tell the complete callback to generate an event for the next request
+ * that will be enqueued by UVCIOC_SEND_RESPONSE.
+ */
+ uvc->event_setup_out = !(ctrl->bRequestType & USB_DIR_IN);
+ uvc->event_length = le16_to_cpu(ctrl->wLength);
+
memset(&v4l2_event, 0, sizeof(v4l2_event));
v4l2_event.type = UVC_EVENT_SETUP;
memcpy(&uvc_event->req, ctrl, sizeof(uvc_event->req));