diff options
Diffstat (limited to 'drivers/media/video/ivtv/ivtv-ioctl.c')
-rw-r--r-- | drivers/media/video/ivtv/ivtv-ioctl.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c index 2c0f27241332..2061d82653fc 100644 --- a/drivers/media/video/ivtv/ivtv-ioctl.c +++ b/drivers/media/video/ivtv/ivtv-ioctl.c | |||
@@ -1446,11 +1446,15 @@ static int ivtv_decoder_ioctls(struct file *filp, unsigned int cmd, void *arg) | |||
1446 | return 0; | 1446 | return 0; |
1447 | if (nonblocking) | 1447 | if (nonblocking) |
1448 | return -EAGAIN; | 1448 | return -EAGAIN; |
1449 | /* wait for event */ | 1449 | /* Wait for event. Note that serialize_lock is locked, |
1450 | so to allow other processes to access the driver while | ||
1451 | we are waiting unlock first and later lock again. */ | ||
1452 | mutex_unlock(&itv->serialize_lock); | ||
1450 | prepare_to_wait(&itv->event_waitq, &wait, TASK_INTERRUPTIBLE); | 1453 | prepare_to_wait(&itv->event_waitq, &wait, TASK_INTERRUPTIBLE); |
1451 | if ((itv->i_flags & (IVTV_F_I_EV_DEC_STOPPED|IVTV_F_I_EV_VSYNC)) == 0) | 1454 | if ((itv->i_flags & (IVTV_F_I_EV_DEC_STOPPED|IVTV_F_I_EV_VSYNC)) == 0) |
1452 | schedule(); | 1455 | schedule(); |
1453 | finish_wait(&itv->event_waitq, &wait); | 1456 | finish_wait(&itv->event_waitq, &wait); |
1457 | mutex_lock(&itv->serialize_lock); | ||
1454 | if (signal_pending(current)) { | 1458 | if (signal_pending(current)) { |
1455 | /* return if a signal was received */ | 1459 | /* return if a signal was received */ |
1456 | IVTV_DEBUG_INFO("User stopped wait for event\n"); | 1460 | IVTV_DEBUG_INFO("User stopped wait for event\n"); |
@@ -1580,12 +1584,9 @@ static int ivtv_v4l2_do_ioctl(struct inode *inode, struct file *filp, | |||
1580 | return 0; | 1584 | return 0; |
1581 | } | 1585 | } |
1582 | 1586 | ||
1583 | int ivtv_v4l2_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, | 1587 | static int ivtv_serialized_ioctl(struct ivtv *itv, struct inode *inode, struct file *filp, |
1584 | unsigned long arg) | 1588 | unsigned int cmd, unsigned long arg) |
1585 | { | 1589 | { |
1586 | struct ivtv_open_id *id = (struct ivtv_open_id *)filp->private_data; | ||
1587 | struct ivtv *itv = id->itv; | ||
1588 | |||
1589 | /* Filter dvb ioctls that cannot be handled by video_usercopy */ | 1590 | /* Filter dvb ioctls that cannot be handled by video_usercopy */ |
1590 | switch (cmd) { | 1591 | switch (cmd) { |
1591 | case VIDEO_SELECT_SOURCE: | 1592 | case VIDEO_SELECT_SOURCE: |
@@ -1620,3 +1621,16 @@ int ivtv_v4l2_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, | |||
1620 | } | 1621 | } |
1621 | return video_usercopy(inode, filp, cmd, arg, ivtv_v4l2_do_ioctl); | 1622 | return video_usercopy(inode, filp, cmd, arg, ivtv_v4l2_do_ioctl); |
1622 | } | 1623 | } |
1624 | |||
1625 | int ivtv_v4l2_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, | ||
1626 | unsigned long arg) | ||
1627 | { | ||
1628 | struct ivtv_open_id *id = (struct ivtv_open_id *)filp->private_data; | ||
1629 | struct ivtv *itv = id->itv; | ||
1630 | int res; | ||
1631 | |||
1632 | mutex_lock(&itv->serialize_lock); | ||
1633 | res = ivtv_serialized_ioctl(itv, inode, filp, cmd, arg); | ||
1634 | mutex_unlock(&itv->serialize_lock); | ||
1635 | return res; | ||
1636 | } | ||