diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2014-09-08 04:18:14 -0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2014-09-08 09:49:28 -0400 |
commit | 26a029f2277bf58c72ada0a92ae44ff9dd702a2e (patch) | |
tree | 7f46c2b62a1be43c631bf31d5b4a4af301a6cdcf /drivers/usb/gadget/function/uvc_v4l2.c | |
parent | b854100eda59a1df9eaf7454cc7c297910055f42 (diff) |
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/uvc_v4l2.c')
-rw-r--r-- | drivers/usb/gadget/function/uvc_v4l2.c | 19 |
1 files changed, 1 insertions, 18 deletions
diff --git a/drivers/usb/gadget/function/uvc_v4l2.c b/drivers/usb/gadget/function/uvc_v4l2.c index bcd71cee7b51..f22b878f163a 100644 --- a/drivers/usb/gadget/function/uvc_v4l2.c +++ b/drivers/usb/gadget/function/uvc_v4l2.c | |||
@@ -271,25 +271,8 @@ uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg) | |||
271 | 271 | ||
272 | /* Events */ | 272 | /* Events */ |
273 | case VIDIOC_DQEVENT: | 273 | case VIDIOC_DQEVENT: |
274 | { | 274 | return v4l2_event_dequeue(&handle->vfh, arg, |
275 | struct v4l2_event *event = arg; | ||
276 | |||
277 | ret = v4l2_event_dequeue(&handle->vfh, event, | ||
278 | file->f_flags & O_NONBLOCK); | 275 | file->f_flags & O_NONBLOCK); |
279 | if (ret == 0 && event->type == UVC_EVENT_SETUP) { | ||
280 | struct uvc_event *uvc_event = (void *)&event->u.data; | ||
281 | |||
282 | /* Tell the complete callback to generate an event for | ||
283 | * the next request that will be enqueued by | ||
284 | * uvc_event_write. | ||
285 | */ | ||
286 | uvc->event_setup_out = | ||
287 | !(uvc_event->req.bRequestType & USB_DIR_IN); | ||
288 | uvc->event_length = uvc_event->req.wLength; | ||
289 | } | ||
290 | |||
291 | return ret; | ||
292 | } | ||
293 | 276 | ||
294 | case VIDIOC_SUBSCRIBE_EVENT: | 277 | case VIDIOC_SUBSCRIBE_EVENT: |
295 | { | 278 | { |