diff options
Diffstat (limited to 'drivers/media/video/ivtv/ivtv-ioctl.c')
-rw-r--r-- | drivers/media/video/ivtv/ivtv-ioctl.c | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c index ecafa697326e..c4bc48143098 100644 --- a/drivers/media/video/ivtv/ivtv-ioctl.c +++ b/drivers/media/video/ivtv/ivtv-ioctl.c | |||
@@ -179,6 +179,7 @@ int ivtv_set_speed(struct ivtv *itv, int speed) | |||
179 | ivtv_vapi(itv, CX2341X_DEC_PAUSE_PLAYBACK, 1, 0); | 179 | ivtv_vapi(itv, CX2341X_DEC_PAUSE_PLAYBACK, 1, 0); |
180 | 180 | ||
181 | /* Wait for any DMA to finish */ | 181 | /* Wait for any DMA to finish */ |
182 | mutex_unlock(&itv->serialize_lock); | ||
182 | prepare_to_wait(&itv->dma_waitq, &wait, TASK_INTERRUPTIBLE); | 183 | prepare_to_wait(&itv->dma_waitq, &wait, TASK_INTERRUPTIBLE); |
183 | while (test_bit(IVTV_F_I_DMA, &itv->i_flags)) { | 184 | while (test_bit(IVTV_F_I_DMA, &itv->i_flags)) { |
184 | got_sig = signal_pending(current); | 185 | got_sig = signal_pending(current); |
@@ -188,6 +189,7 @@ int ivtv_set_speed(struct ivtv *itv, int speed) | |||
188 | schedule(); | 189 | schedule(); |
189 | } | 190 | } |
190 | finish_wait(&itv->dma_waitq, &wait); | 191 | finish_wait(&itv->dma_waitq, &wait); |
192 | mutex_lock(&itv->serialize_lock); | ||
191 | if (got_sig) | 193 | if (got_sig) |
192 | return -EINTR; | 194 | return -EINTR; |
193 | 195 | ||
@@ -1107,6 +1109,7 @@ void ivtv_s_std_dec(struct ivtv *itv, v4l2_std_id *std) | |||
1107 | * happens within the first 100 lines of the top field. | 1109 | * happens within the first 100 lines of the top field. |
1108 | * Make 4 attempts to sync to the decoder before giving up. | 1110 | * Make 4 attempts to sync to the decoder before giving up. |
1109 | */ | 1111 | */ |
1112 | mutex_unlock(&itv->serialize_lock); | ||
1110 | for (f = 0; f < 4; f++) { | 1113 | for (f = 0; f < 4; f++) { |
1111 | prepare_to_wait(&itv->vsync_waitq, &wait, | 1114 | prepare_to_wait(&itv->vsync_waitq, &wait, |
1112 | TASK_UNINTERRUPTIBLE); | 1115 | TASK_UNINTERRUPTIBLE); |
@@ -1115,6 +1118,7 @@ void ivtv_s_std_dec(struct ivtv *itv, v4l2_std_id *std) | |||
1115 | schedule_timeout(msecs_to_jiffies(25)); | 1118 | schedule_timeout(msecs_to_jiffies(25)); |
1116 | } | 1119 | } |
1117 | finish_wait(&itv->vsync_waitq, &wait); | 1120 | finish_wait(&itv->vsync_waitq, &wait); |
1121 | mutex_lock(&itv->serialize_lock); | ||
1118 | 1122 | ||
1119 | if (f == 4) | 1123 | if (f == 4) |
1120 | IVTV_WARN("Mode change failed to sync to decoder\n"); | 1124 | IVTV_WARN("Mode change failed to sync to decoder\n"); |
@@ -1842,8 +1846,7 @@ static long ivtv_default(struct file *file, void *fh, bool valid_prio, | |||
1842 | return 0; | 1846 | return 0; |
1843 | } | 1847 | } |
1844 | 1848 | ||
1845 | static long ivtv_serialized_ioctl(struct ivtv *itv, struct file *filp, | 1849 | long ivtv_v4l2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) |
1846 | unsigned int cmd, unsigned long arg) | ||
1847 | { | 1850 | { |
1848 | struct video_device *vfd = video_devdata(filp); | 1851 | struct video_device *vfd = video_devdata(filp); |
1849 | long ret; | 1852 | long ret; |
@@ -1855,21 +1858,6 @@ static long ivtv_serialized_ioctl(struct ivtv *itv, struct file *filp, | |||
1855 | return ret; | 1858 | return ret; |
1856 | } | 1859 | } |
1857 | 1860 | ||
1858 | long ivtv_v4l2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | ||
1859 | { | ||
1860 | struct ivtv_open_id *id = fh2id(filp->private_data); | ||
1861 | struct ivtv *itv = id->itv; | ||
1862 | long res; | ||
1863 | |||
1864 | /* DQEVENT can block, so this should not run with the serialize lock */ | ||
1865 | if (cmd == VIDIOC_DQEVENT) | ||
1866 | return ivtv_serialized_ioctl(itv, filp, cmd, arg); | ||
1867 | mutex_lock(&itv->serialize_lock); | ||
1868 | res = ivtv_serialized_ioctl(itv, filp, cmd, arg); | ||
1869 | mutex_unlock(&itv->serialize_lock); | ||
1870 | return res; | ||
1871 | } | ||
1872 | |||
1873 | static const struct v4l2_ioctl_ops ivtv_ioctl_ops = { | 1861 | static const struct v4l2_ioctl_ops ivtv_ioctl_ops = { |
1874 | .vidioc_querycap = ivtv_querycap, | 1862 | .vidioc_querycap = ivtv_querycap, |
1875 | .vidioc_s_audio = ivtv_s_audio, | 1863 | .vidioc_s_audio = ivtv_s_audio, |