diff options
author | Sachin Nikam <snikam@nvidia.com> | 2010-06-25 12:28:38 +0530 |
---|---|---|
committer | Bharat Nihalani <bnihalani@nvidia.com> | 2010-06-25 00:10:32 -0700 |
commit | 9e89276dc1ae902a814aca973709ff0724f6f059 (patch) | |
tree | 56d78a9ac37cbd2c0140fab3ad271dbd1e42d1da /drivers | |
parent | be9aaf44eaa0d3047f20bc53fbcd12c478edafbc (diff) |
tegra_uvc: graceful exit on usb camera unplug
Bug 657105
Problem:When the USB Camera is unplugged while preview
VIDIOC_DQBUF ioctl hangs in uvc_queue_waiton()
as it waits on interrupt which will never come,
as USB Camera is unplugged.
Solution:Using wait_event_interruptible_timeout() instead
of wait_event_interruptible() in function uvc_queue_waiton()
with timeout value 250 mSec so as to gracefully exit.
With this change VIDIOC_DQBUF ioctl returns error,
USB Camera driver handles this error to gracefully exit.
Change-Id: I509162ab3d50b7b52e83e015922eff2c83d6e2fb
Reviewed-on: http://git-master/r/3183
Tested-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/uvc/uvc_queue.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/media/video/uvc/uvc_queue.c b/drivers/media/video/uvc/uvc_queue.c index f854698c4061..a071d3311598 100644 --- a/drivers/media/video/uvc/uvc_queue.c +++ b/drivers/media/video/uvc/uvc_queue.c @@ -23,6 +23,8 @@ #include "uvcvideo.h" +#define UVC_Q_WAITON_TIMEOUT 250 /* mSec */ + /* ------------------------------------------------------------------------ * Video buffers queue management. * @@ -299,9 +301,10 @@ static int uvc_queue_waiton(struct uvc_buffer *buf, int nonblocking) ? 0 : -EAGAIN; } - return wait_event_interruptible(buf->wait, + return wait_event_interruptible_timeout(buf->wait, buf->state != UVC_BUF_STATE_QUEUED && - buf->state != UVC_BUF_STATE_ACTIVE); + buf->state != UVC_BUF_STATE_ACTIVE, + UVC_Q_WAITON_TIMEOUT); } /* |