aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx18
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-01-18 15:53:54 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-01-18 15:53:54 -0500
commit4a7c1ff2362b7bfbc04990f42c21cefdff57f997 (patch)
tree82ac9c30ca95b6a92084f5535e6406866eb99cf3 /drivers/media/video/cx18
parent9278e634b4e063f415b46923a9ca4e74f42ec932 (diff)
parent36be126cb0ebe3000a65c1049f339a3e882a9a47 (diff)
Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
* 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (57 commits) [media] as3645a: Fix compilation by including slab.h [media] s5p-fimc: Remove linux/version.h include from fimc-mdevice.c [media] s5p-mfc: Remove linux/version.h include from s5p_mfc.c [media] ds3000: using logical && instead of bitwise & [media] v4l2-ctrls: make control names consistent [media] DVB: dib0700, add support for Nova-TD LEDs [media] DVB: dib0700, add corrected Nova-TD frontend_attach [media] DVB: dib0700, separate stk7070pd initialization [media] DVB: dib0700, move Nova-TD Stick to a separate set [media] : add MODULE_FIRMWARE to dib0700 [media] DVB-CORE: remove superfluous DTV_CMDs [media] s5p-jpeg: adapt to recent videobuf2 changes [media] s5p-g2d: fixed a bug in controls setting function [media] s5p-mfc: Fix volatile controls setup [media] drivers/media/video/s5p-mfc/s5p_mfc.c: adjust double test [media] drivers/media/video/s5p-fimc/fimc-capture.c: adjust double test [media] s5p-fimc: Fix incorrect control ID assignment [media] dvb_frontend: Don't call get_frontend() if idle [media] DocBook/dvbproperty.xml: Remove DTV_MODULATION from ISDB-T [media] DocBook/dvbproperty.xml: Fix ISDB-T delivery system parameters ...
Diffstat (limited to 'drivers/media/video/cx18')
-rw-r--r--drivers/media/video/cx18/cx18-fileops.c41
1 files changed, 14 insertions, 27 deletions
diff --git a/drivers/media/video/cx18/cx18-fileops.c b/drivers/media/video/cx18/cx18-fileops.c
index 14cb961c22bd..4bfd865a4106 100644
--- a/drivers/media/video/cx18/cx18-fileops.c
+++ b/drivers/media/video/cx18/cx18-fileops.c
@@ -751,20 +751,10 @@ int cx18_v4l2_close(struct file *filp)
751 751
752 CX18_DEBUG_IOCTL("close() of %s\n", s->name); 752 CX18_DEBUG_IOCTL("close() of %s\n", s->name);
753 753
754 v4l2_fh_del(fh);
755 v4l2_fh_exit(fh);
756
757 /* Easy case first: this stream was never claimed by us */
758 if (s->id != id->open_id) {
759 kfree(id);
760 return 0;
761 }
762
763 /* 'Unclaim' this stream */
764
765 /* Stop radio */
766 mutex_lock(&cx->serialize_lock); 754 mutex_lock(&cx->serialize_lock);
767 if (id->type == CX18_ENC_STREAM_TYPE_RAD) { 755 /* Stop radio */
756 if (id->type == CX18_ENC_STREAM_TYPE_RAD &&
757 v4l2_fh_is_singular_file(filp)) {
768 /* Closing radio device, return to TV mode */ 758 /* Closing radio device, return to TV mode */
769 cx18_mute(cx); 759 cx18_mute(cx);
770 /* Mark that the radio is no longer in use */ 760 /* Mark that the radio is no longer in use */
@@ -781,10 +771,14 @@ int cx18_v4l2_close(struct file *filp)
781 } 771 }
782 /* Done! Unmute and continue. */ 772 /* Done! Unmute and continue. */
783 cx18_unmute(cx); 773 cx18_unmute(cx);
784 cx18_release_stream(s);
785 } else {
786 cx18_stop_capture(id, 0);
787 } 774 }
775
776 v4l2_fh_del(fh);
777 v4l2_fh_exit(fh);
778
779 /* 'Unclaim' this stream */
780 if (s->id == id->open_id)
781 cx18_stop_capture(id, 0);
788 kfree(id); 782 kfree(id);
789 mutex_unlock(&cx->serialize_lock); 783 mutex_unlock(&cx->serialize_lock);
790 return 0; 784 return 0;
@@ -810,21 +804,15 @@ static int cx18_serialized_open(struct cx18_stream *s, struct file *filp)
810 804
811 item->open_id = cx->open_id++; 805 item->open_id = cx->open_id++;
812 filp->private_data = &item->fh; 806 filp->private_data = &item->fh;
807 v4l2_fh_add(&item->fh);
813 808
814 if (item->type == CX18_ENC_STREAM_TYPE_RAD) { 809 if (item->type == CX18_ENC_STREAM_TYPE_RAD &&
815 /* Try to claim this stream */ 810 v4l2_fh_is_singular_file(filp)) {
816 if (cx18_claim_stream(item, item->type)) {
817 /* No, it's already in use */
818 v4l2_fh_exit(&item->fh);
819 kfree(item);
820 return -EBUSY;
821 }
822
823 if (!test_bit(CX18_F_I_RADIO_USER, &cx->i_flags)) { 811 if (!test_bit(CX18_F_I_RADIO_USER, &cx->i_flags)) {
824 if (atomic_read(&cx->ana_capturing) > 0) { 812 if (atomic_read(&cx->ana_capturing) > 0) {
825 /* switching to radio while capture is 813 /* switching to radio while capture is
826 in progress is not polite */ 814 in progress is not polite */
827 cx18_release_stream(s); 815 v4l2_fh_del(&item->fh);
828 v4l2_fh_exit(&item->fh); 816 v4l2_fh_exit(&item->fh);
829 kfree(item); 817 kfree(item);
830 return -EBUSY; 818 return -EBUSY;
@@ -842,7 +830,6 @@ static int cx18_serialized_open(struct cx18_stream *s, struct file *filp)
842 /* Done! Unmute and continue. */ 830 /* Done! Unmute and continue. */
843 cx18_unmute(cx); 831 cx18_unmute(cx);
844 } 832 }
845 v4l2_fh_add(&item->fh);
846 return 0; 833 return 0;
847} 834}
848 835