aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video
diff options
context:
space:
mode:
authorMike Isely <isely@pobox.com>2006-12-27 21:33:00 -0500
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-02-21 10:34:33 -0500
commit62f5fdace7774a45e75e4d651237e7e1e8f05327 (patch)
treec0d95c7d31d7d755c24869d707400ac39ad1cd99 /drivers/media/video
parent1bde02891b3d4d17ee743584bb49ed5f275dff01 (diff)
V4L/DVB (5052): Pvrusb2: Remove stream claiming hack from /dev/radio
Trying to temporarily check that the stream is not claimed during open of the radio device is at best a race condition. What's to stop another app from claiming the stream anyway the instant after the check is done? The implementation for this was dicey anyway. So it's removed. The only "price" for this is that if /dev/radioX is opened while streaming video, then the video stream is just going to switch to radio mode anyway. If a user does this, he gets what he expects... Signed-off-by: Mike Isely <isely@pobox.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video')
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-context.c11
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-context.h2
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-v4l2.c27
3 files changed, 6 insertions, 34 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-context.c b/drivers/media/video/pvrusb2/pvrusb2-context.c
index 69786cdaa859..cf129746205d 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-context.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-context.c
@@ -188,17 +188,6 @@ void pvr2_channel_done(struct pvr2_channel *cp)
188} 188}
189 189
190 190
191int pvr2_channel_check_stream_no_lock(struct pvr2_channel *cp,
192 struct pvr2_context_stream *sp)
193{
194 if (sp == cp->stream) return 0;
195 if (sp->user) {
196 return -EBUSY;
197 }
198 return 0;
199}
200
201
202int pvr2_channel_claim_stream(struct pvr2_channel *cp, 191int pvr2_channel_claim_stream(struct pvr2_channel *cp,
203 struct pvr2_context_stream *sp) 192 struct pvr2_context_stream *sp)
204{ 193{
diff --git a/drivers/media/video/pvrusb2/pvrusb2-context.h b/drivers/media/video/pvrusb2/pvrusb2-context.h
index 4d0f4ad64122..6327fa1f7e4f 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-context.h
+++ b/drivers/media/video/pvrusb2/pvrusb2-context.h
@@ -76,8 +76,6 @@ void pvr2_channel_init(struct pvr2_channel *,struct pvr2_context *);
76void pvr2_channel_done(struct pvr2_channel *); 76void pvr2_channel_done(struct pvr2_channel *);
77int pvr2_channel_claim_stream(struct pvr2_channel *, 77int pvr2_channel_claim_stream(struct pvr2_channel *,
78 struct pvr2_context_stream *); 78 struct pvr2_context_stream *);
79int pvr2_channel_check_stream_no_lock(struct pvr2_channel *,
80 struct pvr2_context_stream *);
81struct pvr2_ioread *pvr2_channel_create_mpeg_stream( 79struct pvr2_ioread *pvr2_channel_create_mpeg_stream(
82 struct pvr2_context_stream *); 80 struct pvr2_context_stream *);
83 81
diff --git a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
index f74727983df3..cc3260f37e84 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
@@ -925,29 +925,14 @@ static int pvr2_v4l2_open(struct inode *inode, struct file *file)
925 pvr2_trace(PVR2_TRACE_STRUCT,"Creating pvr_v4l2_fh id=%p",fhp); 925 pvr2_trace(PVR2_TRACE_STRUCT,"Creating pvr_v4l2_fh id=%p",fhp);
926 pvr2_channel_init(&fhp->channel,vp->channel.mc_head); 926 pvr2_channel_init(&fhp->channel,vp->channel.mc_head);
927 927
928 /* pk: warning, severe ugliness follows. 18+ only. 928 /* Opening the /dev/radioX device implies a mode switch.
929 please blaim V4L(ivtv) for braindamaged interfaces, 929 So execute that here. Note that you can get the
930 not the implementor. This is probably flawed, but 930 IDENTICAL effect merely by opening the normal video
931 suggestions on how to do this "right" are welcome! */ 931 device and setting the input appropriately. */
932 if (dip->config == pvr2_config_radio) { 932 if (dip->config == pvr2_config_radio) {
933 int ret; 933 pvr2_ctrl_set_value(
934 if ((pvr2_channel_check_stream_no_lock(&fhp->channel,
935 fhp->dev_info->stream)) != 0) {
936 /* We can 't switch modes while streaming */
937 pvr2_channel_done(&fhp->channel);
938 kfree(fhp);
939 pvr2_context_exit(vp->channel.mc_head);
940 return -EBUSY;
941 }
942
943 if ((ret = pvr2_ctrl_set_value(
944 pvr2_hdw_get_ctrl_by_id(hdw,PVR2_CID_INPUT), 934 pvr2_hdw_get_ctrl_by_id(hdw,PVR2_CID_INPUT),
945 PVR2_CVAL_INPUT_RADIO))) { 935 PVR2_CVAL_INPUT_RADIO);
946 pvr2_channel_done(&fhp->channel);
947 kfree(fhp);
948 pvr2_context_exit(vp->channel.mc_head);
949 return ret;
950 }
951 } 936 }
952 937
953 fhp->vnext = NULL; 938 fhp->vnext = NULL;